Bug #1546 » zimuland-vdradmind-timer-dst.patch
vdradmin-am-3.6.9-zimuland/vdradmind 2013-11-03 10:01:05.000000000 +0100 | ||
---|---|---|
#my $time = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, (localtime(time))[8]);
|
||
my $time = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, -1);
|
||
return $time;
|
||
}
|
||
sub time_offset {
|
||
my $dst_diff = 3600;
|
||
my $time = shift;
|
||
my $offset = shift;
|
||
my $old_isdst = (localtime( $time ))[8];
|
||
$time += $offset;
|
||
my $new_isdst = (localtime( $time ))[8];
|
||
$time += ($old_isdst - $new_isdst) * $dst_diff;
|
||
return $time;
|
||
}
|
||
sub ParseTimer {
|
||
... | ... | |
$perrec =~ m/^-+/g;
|
||
$off = ((pos $perrec) + 1) * 86400;
|
||
}
|
||
$startsse += $off;
|
||
$stopsse += $off;
|
||
# Add Offset and fix DST offset
|
||
$startsse = time_offset( $startsse, $off );
|
||
$stopsse = time_offset( $stopsse, $off );
|
||
} elsif (length($dor) == 18) { # first-day timer
|
||
$dor =~ /.{7}\@(\d\d\d\d)-(\d\d)-(\d\d)/;
|
||
$startsse = my_mktime(substr($start, 2, 2), substr($start, 0, 2), $3, ($2 - 1), $1);
|
||
$stopsse = my_mktime(substr($stop, 2, 2), substr($stop, 0, 2), $3, ($2 - 1), $1);
|
||
if ($stopsse < $startsse) {
|
||
$stopsse += 86400; # +1day
|
||
}
|
||
$dor = substr($dor, 0, 7);
|
||
$weekday = ((localtime($startsse))[6] + 6) % 7;
|
||
$perrec = join("", substr($dor, $weekday), substr($dor, 0, $weekday));
|
||
$perrec =~ m/^-+/g;
|
||
$off = (pos $perrec) * 86400;
|
||
# Add Offset and fix DST offset
|
||
$startsse = time_offset( $startsse, $off );
|
||
$stopsse = time_offset( $stopsse, $off );
|
||
# 31 + 1 = ??
|
||
$stopsse = my_mktime(substr($stop, 2, 2), substr($stop, 0, 2), $stop > $start ? $3 : $3 + 1, ($2 - 1), $1);
|
||
} else { # regular timer
|
||
if ($dor =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) { # vdr >= 1.3.23
|
||
$startsse = my_mktime(substr($start, 2, 2), substr($start, 0, 2), $3, ($2 - 1), $1);
|
vdradmin-am-3.6.9-zimuland/vdradmind.pl 2013-11-03 10:01:05.000000000 +0100 | ||
---|---|---|
#my $time = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, (localtime(time))[8]);
|
||
my $time = mktime($sec, $min, $hour, $mday, $mon, $year, 0, 0, -1);
|
||
return $time;
|
||
}
|
||
sub time_offset {
|
||
my $dst_diff = 3600;
|
||
my $time = shift;
|
||
my $offset = shift;
|
||
my $old_isdst = (localtime( $time ))[8];
|
||
$time += $offset;
|
||
my $new_isdst = (localtime( $time ))[8];
|
||
$time += ($old_isdst - $new_isdst) * $dst_diff;
|
||
return $time;
|
||
}
|
||
sub ParseTimer {
|
||
... | ... | |
$perrec =~ m/^-+/g;
|
||
$off = ((pos $perrec) + 1) * 86400;
|
||
}
|
||
$startsse += $off;
|
||
$stopsse += $off;
|
||
# Add Offset and fix DST offset
|
||
$startsse = time_offset( $startsse, $off );
|
||
$stopsse = time_offset( $stopsse, $off );
|
||
} elsif (length($dor) == 18) { # first-day timer
|
||
$dor =~ /.{7}\@(\d\d\d\d)-(\d\d)-(\d\d)/;
|
||
$startsse = my_mktime(substr($start, 2, 2), substr($start, 0, 2), $3, ($2 - 1), $1);
|
||
$stopsse = my_mktime(substr($stop, 2, 2), substr($stop, 0, 2), $3, ($2 - 1), $1);
|
||
if ($stopsse < $startsse) {
|
||
$stopsse += 86400; # +1day
|
||
}
|
||
$dor = substr($dor, 0, 7);
|
||
$weekday = ((localtime($startsse))[6] + 6) % 7;
|
||
$perrec = join("", substr($dor, $weekday), substr($dor, 0, $weekday));
|
||
$perrec =~ m/^-+/g;
|
||
$off = (pos $perrec) * 86400;
|
||
# Add Offset and fix DST offset
|
||
$startsse = time_offset( $startsse, $off );
|
||
$stopsse = time_offset( $stopsse, $off );
|
||
# 31 + 1 = ??
|
||
$stopsse = my_mktime(substr($stop, 2, 2), substr($stop, 0, 2), $stop > $start ? $3 : $3 + 1, ($2 - 1), $1);
|
||
} else { # regular timer
|
||
if ($dor =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) { # vdr >= 1.3.23
|
||
$startsse = my_mktime(substr($start, 2, 2), substr($start, 0, 2), $3, ($2 - 1), $1);
|
- « Previous
- 1
- 2
- Next »