Browse Source

Uses into to avoid "0 minutes"

master
Julio Biason 15 years ago
parent
commit
0ab61b12e2
  1. 5
      mitterlib/ui/helpers/timesince.py

5
mitterlib/ui/helpers/timesince.py

@ -58,7 +58,7 @@ def timesince(d, now=None):
# ignore microsecond part of 'd' since we removed it from 'now' # ignore microsecond part of 'd' since we removed it from 'now'
delta = now - (d - datetime.timedelta(0, 0, d.microsecond)) delta = now - (d - datetime.timedelta(0, 0, d.microsecond))
since = delta.days * 24 * 60 * 60 + delta.seconds since = delta.days * 24 * 60 * 60 + delta.seconds
if since <= 0: if int(since) <= 0:
return 'moments' return 'moments'
for i, (seconds, name) in enumerate(chunks): for i, (seconds, name) in enumerate(chunks):
@ -66,9 +66,6 @@ def timesince(d, now=None):
if count != 0: if count != 0:
break break
if count < 0:
return '%d milliseconds' % math.floor((now - d).microseconds / 1000)
s = '%d %s' % (count, name(count)) s = '%d %s' % (count, name(count))
if i + 1 < len(chunks): if i + 1 < len(chunks):
# Now get the second item # Now get the second item

Loading…
Cancel
Save