Utils: shave a few bytes from Timer

This commit is contained in:
Jérôme Carretero 2013-08-30 01:09:59 -04:00
parent 07cb27929e
commit 2e08d80fce
1 changed files with 4 additions and 4 deletions

View File

@ -628,10 +628,10 @@ class Timer(object):
def __str__(self):
delta = datetime.datetime.utcnow() - self.start_time
days = int(delta.days)
hours = delta.seconds // 3600
minutes = (delta.seconds - hours * 3600) // 60
seconds = delta.seconds - hours * 3600 - minutes * 60 + float(delta.microseconds) / 1000 / 1000
days = delta.days
hours, rem = divmod(delta.seconds, 3600)
minutes, seconds = divmod(rem, 60)
seconds += delta.microseconds * 1e-6
result = ''
if days:
result += '%dd' % days