summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Bishop <stuart@stuartbishop.net>2011-11-04 17:34:33 +0700
committerStuart Bishop <stuart@stuartbishop.net>2011-11-04 17:34:33 +0700
commit27d9586c3ee6f0ffab6ba81e1ef5533f96cc923d (patch)
tree6263c45f8fd8867c362e342550c36eec0b8e5af0
parentfc0e96ff5a2431aacde0141dbdae88282916c411 (diff)
parent391f15a4a31b2114d53ae5510e1c6ffe0043876c (diff)
downloadpytz-27d9586c3ee6f0ffab6ba81e1ef5533f96cc923d.tar.gz
Merge samoa-idl
-rw-r--r--src/pytz/tests/test_tzinfo.py18
-rw-r--r--src/pytz/tzfile.py4
2 files changed, 21 insertions, 1 deletions
diff --git a/src/pytz/tests/test_tzinfo.py b/src/pytz/tests/test_tzinfo.py
index 1543fa8..0516857 100644
--- a/src/pytz/tests/test_tzinfo.py
+++ b/src/pytz/tests/test_tzinfo.py
@@ -533,6 +533,24 @@ class TahitiTestCase(USEasternDSTStartTestCase):
}
+class SamoaInternationalDateLineChange(USEasternDSTStartTestCase):
+ # At the end of 2011, Samoa will switch from being east of the
+ # international dateline to the west. There will be no Dec 30th
+ # 2011 and it will switch from UTC-11 to UTC+13.
+ tzinfo = pytz.timezone('Pacific/Apia')
+ transition_time = datetime(2011, 12, 30, 10, 0, 0, tzinfo=UTC)
+ before = {
+ 'tzname': 'WSDT',
+ 'utcoffset': timedelta(hours=-10),
+ 'dst': timedelta(hours=1),
+ }
+ after = {
+ 'tzname': 'WSDT',
+ 'utcoffset': timedelta(hours=14),
+ 'dst': timedelta(hours=1),
+ }
+
+
class ReferenceUSEasternDSTStartTestCase(USEasternDSTStartTestCase):
tzinfo = reference.Eastern
def test_arithmetic(self):
diff --git a/src/pytz/tzfile.py b/src/pytz/tzfile.py
index 05944da..9c007c8 100644
--- a/src/pytz/tzfile.py
+++ b/src/pytz/tzfile.py
@@ -97,7 +97,9 @@ def build_tzinfo(zone, fp):
break
dst = inf[0] - prev_inf[0] # dst offset
- if dst <= 0: # Bad dst? Look further.
+ # Bad dst? Look further. DST > 24 hours happens when
+ # a timzone has moved across the international dateline.
+ if dst <= 0 or dst > 3600*3:
for j in range(i+1, len(transitions)):
stdinf = ttinfo[lindexes[j]]
if not stdinf[1]: