Merge pull request #192 from galgeek/ss-fix

ss['stop'] not alway set here
This commit is contained in:
jkafader 2020-04-07 11:12:12 -07:00 committed by GitHub
commit e22d80b9a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,7 +153,11 @@ class ElapsedMixIn(object):
'''
dt = 0
for ss in self.starts_and_stops[:-1]:
dt += (ss['stop'] - ss['start']).total_seconds()
if ss['stop']:
dt += (ss['stop'] - ss['start']).total_seconds()
else:
self.logger.warning("missing expected ss['stop']")
dt += (doublethink.utcnow() - ss['start']).total_seconds()
ss = self.starts_and_stops[-1]
if ss['stop']:
dt += (ss['stop'] - ss['start']).total_seconds()