Skip to content

Commit

Permalink
reorganized format_dt
Browse files Browse the repository at this point in the history
  • Loading branch information
forrestv committed Nov 24, 2013
1 parent 396e51e commit 4e7adf0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion p2pool/util/math.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,13 @@ def format(x):
return '%i' % (x,) + s

def format_dt(dt):
for value, name in [(365.2425*60*60*24, 'years'), (60*60*24, 'days'), (60*60, 'hours'), (60, 'minutes'), (1, 'seconds')]:
for value, name in [
(365.2425*60*60*24, 'years'),
(60*60*24, 'days'),
(60*60, 'hours'),
(60, 'minutes'),
(1, 'seconds'),
]:
if dt > value:
break
return '%.01f %s' % (dt/value, name)
Expand Down

0 comments on commit 4e7adf0

Please sign in to comment.