fix divide by zero in speed calculation for short transfers

This commit is contained in:
Patrick Oppenlander 2010-05-12 09:20:15 +10:00 committed by Michael P. Soulier
parent 3c4054617c
commit 360b0b928d

View file

@ -30,6 +30,8 @@ class TftpMetrics(object):
def compute(self):
# Compute transfer time
self.duration = self.end_time - self.start_time
if self.duration == 0:
self.duration = 1
log.debug("TftpMetrics.compute: duration is %s" % self.duration)
self.bps = (self.bytes * 8.0) / self.duration
self.kbps = self.bps / 1024.0