[mythtv-users] Re: DVB summer time

Steve Hayles stevehayles at gmail.com
Mon Mar 28 22:24:22 UTC 2005


FYI,

I use a CVS version from around two months ago and use the DVBDATE
utility from the LinuxTV utilities to set the time.

My cron job ran as normal the morning of the clock change and
everything continued to work perfectly.  Running dvbdate --set within
the script that I use to update the EPG and backup the database seems
to work perfectly.

If anyone wants any more info about my setup then please let me know



On Mon, 28 Mar 2005 23:07:14 +0100, Jon Dye <jon at pecorous.co.uk> wrote:
> Verteiler wrote:
> > Jit V wrote:
> >
> >> Today I switched my Gentoo box from using a localtime of GMT to
> >> London - which now correctly gives the localtime as BST. The time
> >> is also correctly displayed in mythtv, but all of the on-air dvb
> >> guide data is off by 1 hour. Any ideas on how to fix this?
> >>
> >> I've already tried to remove all program data, but the newly
> >> inserted data is still off by one hour.
> >
> > Same thing here. After adjusting daylight saving time the entire
> > program guide is off by an hour
> 
> I have the same problem, I tried adjusting the timezone back to UTC and
> clearing the database but it didn't make a difference.  I then tried
> adjusting the TimeOffset setting in the database (XMLTV time offset in
> the setup program) and that made no difference either.
> 
> I then had a look a the code that inserts the DVB EPG information in the
> database and it appears to be doing a timezone adjustment but I think
> there may be a bug in Qt or maybe the docs are just unclear.
> 
> I wrote a small program to compare the results of myth's timezone
> adjustment (as used in SIParser::ConvertDVBDate) to the localtime and
> UTC time results returned by QT's QDateTime::currentDateTime and the
> results were odd:
> 
> > bash-2.05b$ export TZ="Europe/London"
> > bash-2.05b$ ./QDateTimetest
> > UTC(qt):        Mon Mar 28 17:51:47 2005
> > Local(qt):      Mon Mar 28 18:51:47 2005
> > Local(myth):    Mon Mar 28 17:51:48 2005
> > Local(custom):  Mon Mar 28 18:51:47 2005
> > bash-2.05b$ export TZ="Europe/Amsterdam"
> > bash-2.05b$ ./QDateTimetest
> > UTC(qt):        Mon Mar 28 17:51:52 2005
> > Local(qt):      Mon Mar 28 19:51:52 2005
> > Local(myth):    Mon Mar 28 17:51:53 2005
> > Local(custom):  Mon Mar 28 19:51:52 2005
> > bash-2.05b$ export TZ="America/New_York"
> > bash-2.05b$ ./QDateTimetest
> > UTC(qt):        Mon Mar 28 17:51:58 2005
> > Local(qt):      Mon Mar 28 12:51:58 2005
> > Local(myth):    Mon Mar 28 12:51:58 2005
> > Local(custom):  Mon Mar 28 12:51:58 2005
> 
> Basically I think the way myth uses QT to convert the dates screws up
> daylight saving time (maybe only for Europe, is the US on daylight
> saving yet?)
> 
> The "custom" lines above are using a conversion I wrote which uses the
> timezone offset at the current time (as opposed to the time of the
> scheduled program).  This new conversion method has fixed my problem for
> now and I've attached my test program and a patch for myth to use my
> routine.
> 
> JD
> 
> 
> Index: siparser.cpp
> ===================================================================
> RCS file: /var/lib/mythcvs/mythtv/libs/libmythtv/siparser.cpp,v
> retrieving revision 1.7
> diff -u -r1.7 siparser.cpp
> --- mythtv/libs/libmythtv/siparser.cpp  23 Feb 2005 05:04:36 -0000      1.7
> +++ mythtv/libs/libmythtv/siparser.cpp  28 Mar 2005 17:59:13 -0000
> @@ -931,17 +931,11 @@
>     QDateTime UTCTime = QDateTime(QDate(year,month,day),QTime(hour,min,sec));
> 
>     // Convert to localtime
> -    QDateTime EPOCTime = QDateTime(QDate(1970, 1, 1));
> -    int timesecs = EPOCTime.secsTo(UTCTime);
> +    uint const TimeAdj =
> +        QDateTime::currentDateTime(Qt::LocalTime).toTime_t()
> +        - QDateTime::currentDateTime(Qt::UTC).toTime_t();
> 
> -    QDateTime LocalTime;
> -
> -    LocalTime.setTime_t(timesecs);
> -
> -    QString UTCText = UTCTime.toString();
> -    QString LocalText = LocalTime.toString();
> -
> -    return LocalTime;
> +    return UTCTime.addSecs(TimeAdj);
> 
> }
> 
> 
> #include <qdatetime.h>
> #include <iostream>
> 
> QDateTime GetMythLocalTime(QDateTime const & UTCTime)
> {
>        // Convert to localtime
>        QDateTime EPOCTime = QDateTime(QDate(1970, 1, 1));
>        int timesecs = EPOCTime.secsTo(UTCTime);
> 
>        QDateTime LocalTime;
> 
>        LocalTime.setTime_t(timesecs);
> 
>        return LocalTime;
> }
> 
> QDateTime GetLocalTime(QDateTime const & UTCTime)
> {
>        uint const TimeAdj =
>                QDateTime::currentDateTime(Qt::LocalTime).toTime_t()
>                - QDateTime::currentDateTime(Qt::UTC).toTime_t();
>        return UTCTime.addSecs(TimeAdj);
> }
> 
> int main()
> {
>        QDateTime const nowUTC = QDateTime::currentDateTime(Qt::UTC);
>        QDateTime const nowLocalTime = QDateTime::currentDateTime();
> 
>        std::cout <<
>                "UTC(qt):      \t" << nowUTC.toString() << "\n"
>                "Local(qt):    \t" << nowLocalTime.toString() << "\n"
>                "Local(myth):  \t" << GetMythLocalTime(nowUTC).toString() << "\n"
>                "Local(custom):\t" << GetLocalTime(nowUTC).toString() << std::endl;
> }
> 
> 
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
> 
> 
> 
>


More information about the mythtv-users mailing list