Django

Code

Changeset 6749

Show
Ignore:
Timestamp:
11/29/07 13:39:46 (9 months ago)
Author:
mtredinnick
Message:

Fixed #6023 -- Fixed daylight savings determination for years beyond 2038 on
32-bit systems (modulo the fact that the system timezone libraries might not be
accurate that far out; at least we don't crash now). Thanks, SmileyChris?.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/tzinfo.py

    r5609 r6749  
    5555    def _isdst(self, dt): 
    5656        tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) 
    57         stamp = time.mktime(tt) 
     57        try: 
     58            stamp = time.mktime(tt) 
     59        except OverflowError: 
     60            # 32 bit systems can't handle dates after Jan 2038, so we fake it 
     61            # in that case (since we only care about the DST flag here). 
     62            tt = (2037,) + tt[1:] 
     63            stamp = time.mktime(tt) 
    5864        tt = time.localtime(stamp) 
    5965        return tt.tm_isdst > 0 
  • django/trunk/tests/regressiontests/dateformat/tests.py

    r5876 r6749  
    6767>>> format(my_birthday, r'jS o\f F') 
    6868u'8th of July' 
     69 
     70>>> format(the_future, r'Y') 
     71u'2100' 
    6972""" 
    7073 
     
    8588summertime = datetime.datetime(2005, 10, 30, 1, 00) 
    8689wintertime = datetime.datetime(2005, 10, 30, 4, 00) 
     90the_future = datetime.datetime(2100, 10, 25, 0, 00)