Tools: autotest: correct division-by-zero error

This commit is contained in:
Peter Barker 2019-01-17 09:53:35 +11:00 committed by Andrew Tridgell
parent d71244dd23
commit 429217f392

View File

@ -359,8 +359,12 @@ class AutoTest(ABC):
while self.mav.recv_match(type='SYSTEM_TIME', blocking=False) is not None:
count += 1
tdelta = time.time() - tstart
self.progress("Drained %u messages from mav (%f/s)" % (
count, count/float(tdelta)))
if tdelta == 0:
rate = "instantly"
else:
rate = "%f/s" % (count/float(tdelta),)
self.progress("Drained %u messages from mav (%s)" % (count, rate))
#################################################
# SIM UTILITIES