~ahasenack/ubuntu/oneiric/python-tz/day-leap-fix-885163

« back to all changes in this revision

Viewing changes to debian/patches/samoa-idl

  • Committer: Andreas Hasenack
  • Date: 2012-01-02 20:22:07 UTC
  • Revision ID: andreas@canonical.com-20120102202207-l5885dk506polqdc
Add patch samoa-idl (LP: #885163).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
=== modified file 'pytz/pytz/tests/test_tzinfo.py'
 
2
--- pytz.orig/pytz/tests/test_tzinfo.py 2011-11-04 09:32:28 +0000
 
3
+++ pytz/pytz/tests/test_tzinfo.py      2011-11-04 09:59:20 +0000
 
4
@@ -533,6 +533,24 @@
 
5
         }
 
6
 
 
7
 
 
8
+class SamoaInternationalDateLineChange(USEasternDSTStartTestCase):
 
9
+    # At the end of 2011, Samoa will switch from being east of the
 
10
+    # international dateline to the west. There will be no Dec 30th
 
11
+    # 2011 and it will switch from UTC-11 to UTC+13.
 
12
+    tzinfo = pytz.timezone('Pacific/Apia')
 
13
+    transition_time = datetime(2011, 12, 30, 10, 0, 0, tzinfo=UTC)
 
14
+    before = {
 
15
+        'tzname': 'WSDT',
 
16
+        'utcoffset': timedelta(hours=-10),
 
17
+        'dst': timedelta(hours=1),
 
18
+        }
 
19
+    after = {
 
20
+        'tzname': 'WSDT',
 
21
+        'utcoffset': timedelta(hours=14),
 
22
+        'dst': timedelta(hours=1),
 
23
+        }
 
24
+
 
25
+
 
26
 class ReferenceUSEasternDSTStartTestCase(USEasternDSTStartTestCase):
 
27
     tzinfo = reference.Eastern
 
28
     def test_arithmetic(self):
 
29
 
 
30
=== modified file 'src/pytz/tzfile.py'
 
31
--- src/pytz/tzfile.py  2011-02-08 10:18:52 +0000
 
32
+++ src/pytz/tzfile.py  2011-11-04 10:32:42 +0000
 
33
@@ -97,7 +97,9 @@
 
34
                         break
 
35
                 dst = inf[0] - prev_inf[0] # dst offset
 
36
 
 
37
-                if dst <= 0: # Bad dst? Look further.
 
38
+                # Bad dst? Look further. DST > 24 hours happens when
 
39
+                # a timzone has moved across the international dateline.
 
40
+                if dst <= 0 or dst > 3600*3:
 
41
                     for j in range(i+1, len(transitions)):
 
42
                         stdinf = ttinfo[lindexes[j]]
 
43
                         if not stdinf[1]:
 
44