Ticket #3306: preventing_datefilter_overflow.diff
File preventing_datefilter_overflow.diff, 750 bytes (added by , 18 years ago) |
---|
-
utils/tzinfo.py
46 46 return time.tzname[self._isdst(dt)] 47 47 48 48 def _isdst(self, dt): 49 tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) 49 # clip year value in range which time.mktime accepts 50 if dt.year<1970: 51 year = 1970 52 elif dt.year>2037: 53 year = 2037 54 else: 55 year = dt.year 56 tt = (year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) 50 57 stamp = time.mktime(tt) 51 58 tt = time.localtime(stamp) 52 59 return tt.tm_isdst > 0