Opened 13 years ago

Closed 13 years ago

#11447 closed Bug Report - General (fixed)

Daylight Savings Time transition broken

Reported by: Tom Grigg <tomegrigg@…> 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)

dst-test.py (2.2 KB ) - added by Tom Grigg <tomegrigg@…> 13 years ago.
test case
python-bindings-dst-fix.patch (768 bytes ) - added by Tom Grigg <tomegrigg@…> 13 years ago.
patch

Download all attachments as: .zip

Change History (4)

by Tom Grigg <tomegrigg@…>, 13 years ago

Attachment: dst-test.py added

test case

by Tom Grigg <tomegrigg@…>, 13 years ago

patch

comment:1 by Raymond Wagner, 13 years ago

Milestone: unknown0.27
Status: newaccepted

comment:2 by Raymond Wagner <rwagner@…>, 13 years ago

Resolution: fixed
Status: acceptedclosed

In 6b01d7ba4c2a77fbeed59ba9f2671e8038432611/mythtv:

Error: Processor CommitTicketReference failed
GIT backend not available
Note: See TracTickets for help on using tickets.