Django

Code

Changeset 1579

Show
Ignore:
Timestamp:
12/08/05 20:52:27 (3 years ago)
Author:
adrian
Message:

Fixed #977 -- Fixed timesince() utility. Thanks, pgross@thoughtworks.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r1578 r1579  
    7676    Nebojša Dorđević 
    7777    Sam Newman <http://www.magpiebrain.com/> 
     78    pgross@thoughtworks.com 
     79    phaedo <http://phaedo.cx/> 
    7880    Luke Plant <http://lukeplant.me.uk/> 
    79     phaedo <http://phaedo.cx/> 
    8081    plisk 
    8182    Oliver Rutherfurd <http://rutherfurd.net/> 
  • django/trunk/django/utils/timesince.py

    r1374 r1579  
    55def timesince(d, now=None): 
    66    """ 
    7     Takes a datetime object, returns the time between then and now 
     7    Takes two datetime objects and returns the time between then and now 
    88    as a nicely formatted string, e.g "10 minutes" 
    99    Adapted from http://blog.natbat.co.uk/archive/2003/Jun/14/time_since 
     
    1717    ) 
    1818    if now: 
    19         t = time.mktime(now
     19        t = now.timetuple(
    2020    else: 
    2121        t = time.localtime() 
     
    4848    """ 
    4949    now = datetime.datetime.now() 
    50     return timesince(now, time.mktime(d.timetuple())
     50    return timesince(now, d