diff options
author | Patrick Oppenlander <patrick@motec.com.au> | 2010-05-12 09:20:15 +1000 |
---|---|---|
committer | Michael P. Soulier <msoulier@digitaltorque.ca> | 2010-05-17 19:10:35 -0400 |
commit | 360b0b928d6f8b913fdcdbfa30a8210d996c6c71 (patch) | |
tree | fa23249c522ccc5287bd1135d417d3379cda735a | |
parent | 3c4054617cf8ec51d174689d50606a6732852f33 (diff) | |
download | tftpy-360b0b928d6f8b913fdcdbfa30a8210d996c6c71.tar.gz |
fix divide by zero in speed calculation for short transfers
-rw-r--r-- | tftpy/TftpStates.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tftpy/TftpStates.py b/tftpy/TftpStates.py index 89d512f..8dacff0 100644 --- a/tftpy/TftpStates.py +++ b/tftpy/TftpStates.py @@ -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 |