Bugs item #1587646, was opened at 2006-10-31 02:35
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1587646&group_id=78018
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: win32
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Cameron LEE (noremac_eel)
Assigned to: Nobody/Anonymous (nobody)
Summary: win32timezone: southern hemisphere daylight savings problem
Initial Comment:
I found a bug in the win32timezone: It doesn’t handle
daylight savings for us poor southern hemispherians.
The logic works great for the northerners as your
summer is in the middle of the year. Ours however
straddles 2 years.
The following fixes that. My logic was that if the dst
start month was higher than august, then you aren’t in
the north.
def dst( self, dt ):
"Calculates the daylight savings offset
according to the datetime.tzinfo spec"
if dt is None: return
assert dt.tzinfo is self
result = self.standardBiasOffset
try:
dstStart = self.GetDSTStartTime( dt.year )
dstEnd = self.GetDSTEndTime( dt.year )
if dstStart.month > 8:
if not (dstEnd < dt.replace(
tzinfo=None ) <= dstStart) and not self.fixedStandardTime:
result = self.daylightBiasOffset
else:
if dstStart <= dt.replace( tzinfo=None
) < dstEnd and not self.fixedStandardTime:
result = self.daylightBiasOffset
except ValueError:
# there was an error parsing the time zone,
which is normal when a
# start and end time are not specified.
pass
return result
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1587646&group_id=78018
|