Mailing List Archive

[PATCH] implemented time offset for mythfilldatabase
Hi mythies,

since I try to add nxtvepg(.sf.net) as a source for the xmltv-data I needed to
make mythfilldatabase aware of timeoffsets in the data (given as <programm
start="20021118150800 +0100" ...>). Therefore i programmed a patch for
programms/mythfilldatabase/filldata.cpp.

You only need to add a settingskey "str TIMEoffset=+0100" with your local
offset (in hours). If you don't set this key, everything should work as
before.

This is, of course, only tested on my system, so could you please verify that
this is working?


take care, have fun
/christian

PS.: This is not the nicest code, but I tried to keep it easy readable, like
the other code of mythtv :-)
Re: [PATCH] implemented time offset for mythfilldatabase [ In reply to ]
Ok, maybe this is a better implementation of the addTimeOffset() ;-)

void addTimeOffset(QString &timestr, int config_off, QString offset )
{
bool ok;
int off = offset.stripWhiteSpace().left(3).toInt(&ok, 10);

if (ok && (off != config_off))
{
int diff = config_off - off;
int year, month, day, hour, min, sec;

if (timestr.length() == 14)
{
year = timestr.left(4).toInt(&ok, 10);
month = timestr.mid(4,2).toInt(&ok, 10);
day = timestr.mid(6,2).toInt(&ok, 10);
hour = timestr.mid(8,2).toInt(&ok, 10);
min = timestr.mid(10,2).toInt(&ok, 10);
sec = timestr.mid(12,2).toInt(&ok, 10);
}
else if (timestr.length() == 12)
{
year = timestr.left(2).toInt(&ok, 10);
month = timestr.mid(2,2).toInt(&ok, 10);
day = timestr.mid(4,2).toInt(&ok, 10);
hour = timestr.mid(6,2).toInt(&ok, 10);
min = timestr.mid(8,2).toInt(&ok, 10);
sec = timestr.mid(10,2).toInt(&ok, 10);
}

QDateTime dt = QDateTime(QDate (year, month, day),QTime(hour, min, sec));
dt = dt.addSecs(diff * 60 * 60);
timestr = dt.toString("yyyyMMddhhmmss");
}
}
Re: [PATCH] implemented time offset for mythfilldatabase [ In reply to ]
On Monday 18 November 2002 09:14 am, Christian Hoenig wrote:
> Hi mythies,
>
> since I try to add nxtvepg(.sf.net) as a source for the xmltv-data I needed
> to make mythfilldatabase aware of timeoffsets in the data (given as
> <programm start="20021118150800 +0100" ...>). Therefore i programmed a
> patch for programms/mythfilldatabase/filldata.cpp.
>
> You only need to add a settingskey "str TIMEoffset=+0100" with your local
> offset (in hours). If you don't set this key, everything should work as
> before.
>
> This is, of course, only tested on my system, so could you please verify
> that this is working?

Why not have it parse the +0100 out of the timestamp, instead of using a
setting for that?

Isaac
Re: [PATCH] implemented time offset for mythfilldatabase [ In reply to ]
Am Montag, 18. November 2002 18:36 schrieb Isaac Richards:
> On Monday 18 November 2002 09:14 am, Christian Hoenig wrote:
> > since I try to add nxtvepg(.sf.net) as a source for the xmltv-data I
> > needed to make mythfilldatabase aware of timeoffsets in the data (given
> > as <programm start="20021118150800 +0100" ...>). Therefore i programmed a
> > patch for programms/mythfilldatabase/filldata.cpp.
> >
> > You only need to add a settingskey "str TIMEoffset=+0100" with your local
> > offset (in hours). If you don't set this key, everything should work as
> > before.
> >
> > This is, of course, only tested on my system, so could you please verify
> > that this is working?
>
> Why not have it parse the +0100 out of the timestamp, instead of using a
> setting for that?

The setting in the configfile tells the system, in which timezone YOU are, the
+0100 of the timestamp tells the system, in which timezone the DATA is given.
So to set up the correct times, the difference of that has to be used.

take care, have fun
/christian