bandwidth meter - avoid division by zero

This commit is contained in:
tosh 2013-07-03 14:01:09 +02:00
parent f3ab3b6c83
commit a542ebc851

View file

@ -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