Bugs item #1587646, was opened at 2006-10-31 13:35
Message generated for change (Comment added) made by mhammond
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
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2006-10-31 16:22
Message:
Logged In: YES
user_id=14198
It appears your editor changed the whitespace in the file,
and modified the utf8 'copyright' character. I've attached
the changes as a patch and asked Jason to have a quick look.
Thanks,
Mark
----------------------------------------------------------------------
Comment By: Cameron LEE (noremac_eel)
Date: 2006-10-31 15:50
Message:
Logged In: YES
user_id=284417
p.s. am in sunny Queensland :-)
BrisVegus.
Cameron.
----------------------------------------------------------------------
Comment By: Cameron LEE (noremac_eel)
Date: 2006-10-31 15:48
Message:
Logged In: YES
user_id=284417
hope this is what yu are after.
appended to bottom of module doctests
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2006-10-31 15:05
Message:
Logged In: YES
user_id=14198
I meant to ask this before, but can you please also give me
an example of code that failed and works with the patch?
I'm in Melbourne so should be able to test easily :)
Thanks
----------------------------------------------------------------------
Comment By: Cameron LEE (noremac_eel)
Date: 2006-10-31 14:24
Message:
Logged In: YES
user_id=284417
yes, much nicer! :-)
also need to update value for dstend.
(attached)
Cheers,
Cameron.
----------------------------------------------------------------------
Comment By: Mark Hammond (mhammond)
Date: 2006-10-31 13:50
Message:
Logged In: YES
user_id=14198
Wouldn't a better fix be to check if dstStart > dstEnd
rather than assuming something special about August?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1587646&group_id=78018
|