2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

95_holiday.pm: Fix clock change issues for tomorrow et al (Forum #123808)

git-svn-id: https://svn.fhem.de/fhem/trunk@25164 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2021-11-01 10:07:38 +00:00
parent 2c4b5d130b
commit 29ee315c9b

View File

@ -307,8 +307,17 @@ holiday_Get($@)
} elsif($a[1] =~ m/^(yesterday|today|tomorrow)$/) {
my $t = time();
$t += 86400 if($a[1] eq "tomorrow");
$t -= 86400 if($a[1] eq "yesterday");
if($a[1] =~ m/^(yesterday|tomorrow)$/) { # clock change issues, #123808
my $inc = ($a[1] eq "tomorrow" ? 3600 : -3600);
my @now = localtime($t);
for(;;) {
$t += $inc;
my @then = localtime($t);
last if($then[3] != $now[3]);
}
}
my @a = localtime($t);
$arg = sprintf("%04d-%02d-%02d", $a[5]+1900, $a[4]+1, $a[3]);