Opened 8 years ago
Closed 8 years ago
#11447 closed Bug Report - General (fixed)
Daylight Savings Time transition broken
Reported by: | Owned by: | Raymond Wagner | |
---|---|---|---|
Priority: | minor | Milestone: | 0.27 |
Component: | Bindings - Python | Version: | 0.26-fixes |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
The POSIX timezone implementation in the MythTV python bindings does not properly handle the transition to summer (daylight savings) time, which occurs here in the USA this coming weekend.
This is caused by scanning the transition table using the local time entry, which for the transition to DST is actually one hour ahead of the time for which the transition is being looked up.
A symptom of this issue is that attempting to convert a datetime instance from UTC to local time during the transition and the hour following will result in an incorrect result. For example:
starttime = datetime.duck('2013-03-10T10:30:00Z') print starttime.astimezone(datetime.localTZ())
will print
2013-03-10 02:30:00-08:00
instead of
2013-03-10 03:30:00-07:00
Attached is a testcase and a quick and dirty patch which fixes the issue. It may be more elegant to implement a fix as the zoneinfo tables are read rather than during transition search.
Attachments (2)
Change History (4)
Changed 8 years ago by
Attachment: | dst-test.py added |
---|
comment:1 Changed 8 years ago by
Milestone: | unknown → 0.27 |
---|---|
Status: | new → accepted |
comment:2 Changed 8 years ago by
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
test case