mirror of
				https://github.com/django/django.git
				synced 2025-10-29 08:36:09 +00:00 
			
		
		
		
	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:
		| @@ -1,4 +1,4 @@ | |||||||
| import datetime, time | import datetime, math, time | ||||||
| from django.utils.tzinfo import LocalTimezone | from django.utils.tzinfo import LocalTimezone | ||||||
| from django.utils.translation import ngettext | from django.utils.translation import ngettext | ||||||
|  |  | ||||||
| @@ -30,6 +30,8 @@ def timesince(d, now=None): | |||||||
|         count = since / seconds |         count = since / seconds | ||||||
|         if count != 0: |         if count != 0: | ||||||
|             break |             break | ||||||
|  |     if count < 0: | ||||||
|  |         return '%d milliseconds' % math.floor(delta.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 | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user