~mnordhoff/+junk/devel.btrees

« back to all changes in this revision

Viewing changes to src/pytz/tzfile.py

  • Committer: Stuart Bishop
  • Date: 2009-09-28 04:54:10 UTC
  • Revision ID: stuart@stuartbishop.net-20090928045410-eps1qwudw81gejdb
Look harder if we end up with a negative DST offset

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
    head_size = calcsize(head_fmt)
17
17
    (magic,ttisgmtcnt,ttisstdcnt,leapcnt,
18
18
     timecnt,typecnt,charcnt) =  unpack(head_fmt, fp.read(head_size))
19
 
    
 
19
 
20
20
    # Make sure it is a tzinfo(5) file
21
21
    assert magic == 'TZif'
22
22
 
83
83
                    if not prev_inf[1]:
84
84
                        break
85
85
                dst = inf[0] - prev_inf[0] # dst offset
 
86
 
 
87
                if dst < 0: # Negative dst? Look further.
 
88
                    for j in range(i+1, len(transitions)):
 
89
                        stdinf = ttinfo[lindexes[j]]
 
90
                        if not stdinf[1]:
 
91
                            break # Found std time.
 
92
                    dst = inf[0] - stdinf[0]
 
93
 
86
94
            tzname = inf[2]
87
95
 
88
96
            # Round utcoffset and dst to the nearest minute or the