2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-23 20:52:13 +00:00

95:Astro.pm: Bugfix Sommerzeit

git-svn-id: https://svn.fhem.de/fhem/trunk@16494 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
phenning 2018-03-26 12:10:44 +00:00
parent 91374d9b3e
commit aebf9e559a

View File

@ -47,7 +47,7 @@ my $deltaT = 65; # Correction time in s
my %Astro; my %Astro;
my %Date; my %Date;
my $astroversion = 1.42; my $astroversion = 1.43;
#-- These we may get on request #-- These we may get on request
my %gets = ( my %gets = (
@ -353,7 +353,13 @@ sub Astro_round($$) { my ($x,$n)=@_; return int(10**$n*$x+0.5)/10**$n};
sub Astro_tzoffset($) { sub Astro_tzoffset($) {
my ($t) = @_; my ($t) = @_;
my $utc = mktime(gmtime($t)); my $utc = mktime(gmtime($t));
#-- the following does not properly calculate dst
my $local = mktime(localtime($t)); my $local = mktime(localtime($t));
my ($sec, $min, $hour, $day, $month, $year, $wday, $yday, $isdst) = localtime(time);
#-- correction
if($isdst == 1){
$local+=3600;
}
return (($local - $utc)/36); return (($local - $utc)/36);
} }
@ -1289,6 +1295,7 @@ sub Astro_Update($@) {
$Date{hour} = $hour; $Date{hour} = $hour;
$Date{min} = $min; $Date{min} = $min;
$Date{sec} = $sec; $Date{sec} = $sec;
$Date{isdst}= $isdst;
#-- broken on windows #-- broken on windows
#$Date{zonedelta} = (strftime "%z", localtime)/100; #$Date{zonedelta} = (strftime "%z", localtime)/100;
$Date{zonedelta} = Astro_tzoffset(time)/100; $Date{zonedelta} = Astro_tzoffset(time)/100;
@ -1354,6 +1361,7 @@ sub Astro_Get($@) {
$Date{hour} = $hour; $Date{hour} = $hour;
$Date{min} = $min; $Date{min} = $min;
$Date{sec} = $sec; $Date{sec} = $sec;
$Date{isdst}= $isdst;
#-- broken on windows #-- broken on windows
#$Date{zonedelta} = (strftime "%z", localtime)/100; #$Date{zonedelta} = (strftime "%z", localtime)/100;
$Date{zonedelta} = Astro_tzoffset(time)/100; $Date{zonedelta} = Astro_tzoffset(time)/100;