Discussion:
[Xmltv-devel] [ xmltv-Bugs-3098768 ] _ch_search: not honoring daylight saving time
SourceForge.net
2011-04-07 15:41:12 UTC
Permalink
Bugs item #3098768, was opened at 2010-10-30 09:27
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=424135&aid=3098768&group_id=39046

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: tv_grab_ch_search
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Patric Mueller (bhaak)
Assigned to: Nobody/Anonymous (nobody)
Summary: _ch_search: not honoring daylight saving time

Initial Comment:
The current CVS version of tv_grab_ch_search has the CET timezone hardcoded:
tv_grab_ch_search.in:148 ## the timezone tv.search.ch lives in is, CET/CEST
tv_grab_ch_search.in:149: my constant $TZ = "+0100";

For the time being this problem will of course resolve itself tonight. :)

----------------------------------------------------------------------

Comment By: Nobody/Anonymous (nobody)
Date: 2011-04-07 15:41

Message:
FAwxlO <a href="http://ssnkrdayqtgg.com/">ssnkrdayqtgg</a>,
[url=http://kccaibvvmmru.com/]kccaibvvmmru[/url],
[link=http://djispsapblyd.com/]djispsapblyd[/link],
http://atnifpjbekaz.com/

----------------------------------------------------------------------

Comment By: Karl Dietz (dekarl)
Date: 2011-03-30 08:48

Message:
Hi Thomi,

here it the code from _pt_meo
use the module
102: use DateTime;

get the time from the data
206: my $starttime = $xpc->findvalue( 'EPG:StartTime', $inprog );
convert text into timestamp
207: my $dtstart = dt_from_string( $starttime );
add timestmap to programme, using XMLTV format (%z is +0100 or +0200
depending on the timestamp)
208: $prog{start} = $dtstart->strftime( '%Y%m%d%H%M%S %z' );

that's the function that converts the time
272: sub dt_from_string
273: {
store parameters into $string, you might want to keep date and time
seperate and use ( $date, $time ) to have two parameters
274: my( $string ) = @_;
split $string into parts of the timestamp source has "YYYY-MM-DD HH:MM:SS"
format. If you keep date/time seperate you can just copy these lines and
split date/time in two steps
275: my($year, $month, $day, $hour, $minute, $second) =
276: ($string =~ m|(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})|);
create timestamp from values
277: my $dt = DateTime->new( year => $year,
278: month => $month,
279: day => $day,
280: hour => $hour,
281: minute => $minute,
if you don't have seconds you can just drop that line
282: second => $second,
the timestamp is in localtime as appropriate for Portugal, Europe/Zurich
would be used for Switzerland
283: time_zone => 'Europe/Lisbon',
284: );
285: return $dt;
286: }



the part in _ch_search is this:
mix $grabDate and the time
409: my $tmp = substr($grabDate,0,4) . substr($grabDate,4,2) .
substr($grabDate,6,2) .(($tv_show->look_down('_tag',
'td'))[0])->as_text();
drop : from the time
410: $tmp =~ s/://;
append fixed time offset
411: my $start = "$tmp"."00 $TZ";
store the start time in the programme
412: $show{start} = $start;


Regards,
Karl

----------------------------------------------------------------------

Comment By: thomi_ch (thomi_ch)
Date: 2011-03-30 08:26

Message:
hey karl

don't be the perl specialist, in the moment ;)..
can you point me to the right lines, maybe then i can make some tests...

thanks a lot
thomi

----------------------------------------------------------------------

Comment By: Karl Dietz (dekarl)
Date: 2011-03-30 08:11

Message:
great that you found a workaround that is working for now!
But that fix will break the schedule when you grab for days that are on
the other side of the DST switch.

Can you take a look at _pt_meo? It is converting floating localtime into
specific localtime, too. (and really simple, that's why I'm suggesting it)
That would solve all issues but one. That being invalid localtime in the
guide, like 02:30 when the clock jumps from 01:59 to 03:00.

Regards,
Karl

----------------------------------------------------------------------

Comment By: thomi_ch (thomi_ch)
Date: 2011-03-29 11:52

Message:
hey patric

thanks for your solution/workaround.. fixed it like this.. and also added
this line after #!/usr/bin/perl

use POSIX;

now times are correct ;)...

----------------------------------------------------------------------

Comment By: Patric Mueller (bhaak)
Date: 2011-03-28 19:40

Message:
A workaround I'm using is using
my constant $TZ = strftime("%z",localtime);

This returns the current time zone offset.

This isn't a real solution as the dates after the change of the daylight
saving time are still wrong if they come from a run of the program before
the change of the daylight saving time.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=424135&aid=3098768&group_id=39046
Loading...