2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

90_at.pm: Fix sommertime-change issues (Forum #35586)

git-svn-id: https://svn.fhem.de/fhem/trunk@8326 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-03-29 13:30:57 +00:00
parent 472fe8441d
commit 9a57b5dd6e

View File

@ -23,27 +23,22 @@ at_Initialize($)
}
my $at_stt_sec;
my $at_stt_day;
my %at_stt;
my $at_detailFnCalled;
sub
at_SecondsTillTomorrow($) # 86400, if tomorrow is no DST change
{
my $t = shift;
my $day = int($t/86400);
my $dayHour = int($t/3600);
if(!$at_stt_day || $day != $at_stt_day) {
my $t = $day*86400+12*3600;
if(!$at_stt{$dayHour}) {
my @l1 = localtime($t);
my @l2 = localtime($t+86400);
$at_stt_sec = 86400+
($l1[2]-$l2[2])*3600+
($l1[1]-$l2[1])*60;
$at_stt_day = $day;
$at_stt{$dayHour} = 86400+($l1[2]-$l2[2])*3600;
}
return $at_stt_sec;
return $at_stt{$dayHour};
}
@ -85,7 +80,7 @@ at_Define($$)
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]) # Midnight for absolute time
if($rel ne "+");
$nt += ($hr*3600+$min*60+$sec); # Plus relative time
$nt += at_SecondsTillTomorrow($ot) if($ot >= $nt); # Do it tomorrow...
$nt += at_SecondsTillTomorrow($nt) if($ot >= $nt); # Do it tomorrow...
@lt = localtime($nt);
my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
if($rep) { # Setting the number of repetitions