Commit fce688cc authored by Adrian Holovaty's avatar Adrian Holovaty
Browse files

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
parent 87e0c2a7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
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