mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
90_at.pm: fix DST change-bug (Forum #42920)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9660 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
e9d9973531
commit
7f36b2c7c6
@ -4,6 +4,7 @@ package main;
|
|||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
use POSIX;
|
||||||
use Time::HiRes qw(gettimeofday);
|
use Time::HiRes qw(gettimeofday);
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
@ -35,7 +36,7 @@ at_SecondsTillTomorrow($) # 86400, if tomorrow is no DST change
|
|||||||
if(!$at_stt{$dayHour}) {
|
if(!$at_stt{$dayHour}) {
|
||||||
my @l1 = localtime($t);
|
my @l1 = localtime($t);
|
||||||
my @l2 = localtime($t+86400);
|
my @l2 = localtime($t+86400);
|
||||||
$at_stt{$dayHour} = 86400+($l1[2]-$l2[2])*3600;
|
$at_stt{$dayHour} = 86400+($l1[8]-$l2[8])*3600;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $at_stt{$dayHour};
|
return $at_stt{$dayHour};
|
||||||
@ -74,14 +75,20 @@ at_Define($$)
|
|||||||
|
|
||||||
my $ot = $data{AT_TRIGGERTIME} ? $data{AT_TRIGGERTIME} : gettimeofday();
|
my $ot = $data{AT_TRIGGERTIME} ? $data{AT_TRIGGERTIME} : gettimeofday();
|
||||||
$ot = int($ot) if(!$rel); # No way to specify subseconds
|
$ot = int($ot) if(!$rel); # No way to specify subseconds
|
||||||
my @lt = localtime($ot);
|
|
||||||
my $nt = $ot;
|
my $nt = $ot;
|
||||||
|
|
||||||
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]) # Midnight for absolute time
|
if($rel eq "+") {
|
||||||
if($rel ne "+");
|
$nt += ($hr*3600+$min*60+$sec); # Relative time
|
||||||
$nt += ($hr*3600+$min*60+$sec); # Plus relative time
|
|
||||||
$nt += at_SecondsTillTomorrow($nt) if($ot >= $nt); # Do it tomorrow...
|
} else {
|
||||||
@lt = localtime($nt);
|
my @lt = localtime($ot);
|
||||||
|
($lt[2], $lt[1], $lt[0]) = ($hr+0, $min+0, $sec+0);
|
||||||
|
$nt = mktime(@lt[0..6]);
|
||||||
|
$nt += at_SecondsTillTomorrow($nt) if($ot >= $nt); # Do it tomorrow...
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
my @lt = localtime($nt);
|
||||||
my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
|
my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
|
||||||
if($rep) { # Setting the number of repetitions
|
if($rep) { # Setting the number of repetitions
|
||||||
$cnt =~ s/[{}]//g;
|
$cnt =~ s/[{}]//g;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user