Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #886 -- timesince utility now supports microseconds. Thanks, Aa…

…ron Swartz

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1374 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fce688cc743bd77c8e415c5a7a409b5fe211e6f7 1 parent 87e0c2a
@adrianholovaty adrianholovaty authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 django/utils/timesince.py
View
4 django/utils/timesince.py
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.