[mythtv-commits] Ticket #9676: Obtaining program times across daylight savings time change gives inaccurate results
MythTV
noreply at mythtv.org
Mon Mar 21 01:05:10 UTC 2011
#9676: Obtaining program times across daylight savings time change gives
inaccurate results
------------------------------------+----------------------------------
Reporter: mythtv@… | Type: Patch - Bug Fix
Status: new | Priority: minor
Milestone: unknown | Component: MythTV - General
Version: 0.24-fixes | Severity: medium
Keywords: | Ticket locked: 0
------------------------------------+----------------------------------
This bug affects users having a TimeOffset set to 'Auto'. I can testify
that it affects schedulesdirect data, but it would apply to any listing
service that lists using UTC time.
The bug is that in the days leading up to a daylight savings time change,
when mythfilldatabase obtains program information for a day after the
daylight savings time change will have occurred, the time of that program
is calculated incorrectly. By the time the time change actually happens,
your program guide has roughly two weeks of incorrect data loaded into it.
The workaround is to wait until the time changes, clear out that data, and
do a new mythfilldatabase.
The bug is in the MythSecsTo utility function, because it calculates the
time difference independently of the day, and thus can't take into account
the hour lost or gained across a daylight savings change.
I will attach a patch that addresses the problem. This simple program
demonstrates the problem for CST or other time zones that changed local
time on March 13 this year:
{{{
#include <iostream>
#include <util.h>
using namespace std;
int main(int argc, char** argv) {
// this range should only cover a 23-hour period, due to the time change
in
// the middle of it
QDateTime before = QDateTime(QDate(2011,3,12), QTime(23, 00, 00));
QDateTime after = QDateTime(QDate(2011,3,13), QTime(23, 00, 00));
cout << MythSecsTo(before,after) / 60 / 60
<< " vs " << before.secsTo(after) /60 / 60
<< "\n";;
}
}}}
I hope this is not a dup - I searched for tickets, and although some were
in the neighborhood none seemed completely like this issue. Apologies if I
missed the right ticket.
--
Ticket URL: <http://code.mythtv.org/trac/ticket/9676>
MythTV <http://code.mythtv.org/trac>
MythTV Media Center
More information about the mythtv-commits
mailing list