Fixed #886 -- timesince utility now supports microseconds. Thanks, Aaron Swartz

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-11-23 21:13:00 +00:00
parent 87e0c2a712
commit fce688cc74
1 changed files with 3 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import datetime, time
import datetime, math, time
from django.utils.tzinfo import LocalTimezone
from django.utils.translation import ngettext
@ -30,6 +30,8 @@ def timesince(d, now=None):
count = since / seconds
if count != 0:
break
if count < 0:
return '%d milliseconds' % math.floor(delta.microseconds / 1000)
s = '%d %s' % (count, name(count))
if i + 1 < len(chunks):
# Now get the second item