diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-11-29 19:39:46 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-11-29 19:39:46 +0000 |
| commit | f3c15225fc58ae45c6aa71eb5174ff66f3f5e974 (patch) | |
| tree | 8d7641bf1cf793d21dc55cca00dee505f29ab3e4 /django | |
| parent | 260f9c51127702afcb1d2c669e0ec1855bdea58c (diff) | |
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.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6749 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/utils/tzinfo.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/utils/tzinfo.py b/django/utils/tzinfo.py index e2e1d10fc1..7d5ead9290 100644 --- a/django/utils/tzinfo.py +++ b/django/utils/tzinfo.py @@ -54,6 +54,12 @@ class LocalTimezone(tzinfo): def _isdst(self, dt): tt = (dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.weekday(), 0, -1) - stamp = time.mktime(tt) + try: + stamp = time.mktime(tt) + except OverflowError: + # 32 bit systems can't handle dates after Jan 2038, so we fake it + # in that case (since we only care about the DST flag here). + tt = (2037,) + tt[1:] + stamp = time.mktime(tt) tt = time.localtime(stamp) return tt.tm_isdst > 0 |
