mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 03:43:33 +02:00
bandwidth meter - avoid division by zero
This commit is contained in:
parent
f3ab3b6c83
commit
a542ebc851
1 changed files with 6 additions and 0 deletions
|
@ -68,6 +68,12 @@ void BandwidthMeter::Stream::updateValue(double amount) {
|
|||
timeval now;
|
||||
gettimeofday(& now, NULL);
|
||||
double dt = diffclock(& _prevTime, & now);
|
||||
|
||||
// Ignore this value when timer imprecision yields dt = 0
|
||||
if (dt == 0.0) {
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(& _prevTime, & now, sizeof(timeval));
|
||||
|
||||
// Compute approximate average
|
||||
|
|
Loading…
Reference in a new issue