From 75aa0a5348c908b2206d133e372ae9710c898fed Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Tue, 10 May 2005 20:58:00 +0000 Subject: Handle multiple in-dst zones in sequence correctly (US/... Author: zenzen Date: 2004-07-22 00:56:19 GMT Handle multiple in-dst zones in sequence correctly (US/Eastern's EWT & EPT for example) --- gen_tzinfo.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gen_tzinfo.py') diff --git a/gen_tzinfo.py b/gen_tzinfo.py index 9be94b8..66cdafb 100644 --- a/gen_tzinfo.py +++ b/gen_tzinfo.py @@ -1,6 +1,6 @@ #!/usr/bin/env python ''' -$Id: gen_tzinfo.py,v 1.16 2004/07/19 22:31:45 zenzen Exp $ +$Id: gen_tzinfo.py,v 1.17 2004/07/22 00:56:19 zenzen Exp $ ''' import sys, os, os.path, shutil @@ -174,7 +174,12 @@ class DstGen(Gen): if not inf[1]: dst = 0 else: - dst = inf[0] - transitions[i-1][1] # seconds dstoffset + # Locate the last non-dst transition + for j in range(i-1, -1, -1): + prev_trans = transitions[j] + if not prev_trans[2]: + break + dst = inf[0] - prev_trans[1] # seconds dstoffset dst = dst.seconds + dst.days*86400 tzname = inf[2] -- cgit v1.2.1