2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

59_Twilight.pm: add daylightsaving feature

git-svn-id: https://svn.fhem.de/fhem/trunk@23018 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
Beta-User 2020-10-24 15:35:48 +00:00
parent 7bf88b29e3
commit 72c00fd269

View File

@ -773,6 +773,10 @@ sub Twilight_Midnight {
}
my $now = time();
my $midnight = $now - secondsSinceMidnight( $now ) + DAYSECONDS + 1;
my $daysavingdelta = (localtime)[2] - ( localtime( time + DAYSECONDS ) )[2];
$midnight -= 19 * HOURSECONDS if $daysavingdelta == 1 && (localtime)[2] < 3;
$midnight -= 20 * HOURSECONDS if $daysavingdelta == -1 && (localtime)[2] < 3;
return resetRegisteredInternalTimer( "Midnight", $midnight, \&Twilight_Midnight, $hash, 0 );
}