From a4ca4ec361cee7bd43218a0b806deeb60ce2f6d5 Mon Sep 17 00:00:00 2001 From: phenning Date: Mon, 26 Mar 2018 12:10:44 +0000 Subject: [PATCH] 95:Astro.pm: Bugfix Sommerzeit git-svn-id: https://svn.fhem.de/fhem/trunk@16494 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/95_Astro.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/fhem/FHEM/95_Astro.pm b/fhem/FHEM/95_Astro.pm index 9c26447a8..4ee88d900 100644 --- a/fhem/FHEM/95_Astro.pm +++ b/fhem/FHEM/95_Astro.pm @@ -47,7 +47,7 @@ my $deltaT = 65; # Correction time in s my %Astro; my %Date; -my $astroversion = 1.42; +my $astroversion = 1.43; #-- These we may get on request my %gets = ( @@ -353,7 +353,13 @@ sub Astro_round($$) { my ($x,$n)=@_; return int(10**$n*$x+0.5)/10**$n}; sub Astro_tzoffset($) { my ($t) = @_; my $utc = mktime(gmtime($t)); + #-- the following does not properly calculate dst 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); } @@ -1289,6 +1295,7 @@ sub Astro_Update($@) { $Date{hour} = $hour; $Date{min} = $min; $Date{sec} = $sec; + $Date{isdst}= $isdst; #-- broken on windows #$Date{zonedelta} = (strftime "%z", localtime)/100; $Date{zonedelta} = Astro_tzoffset(time)/100; @@ -1354,6 +1361,7 @@ sub Astro_Get($@) { $Date{hour} = $hour; $Date{min} = $min; $Date{sec} = $sec; + $Date{isdst}= $isdst; #-- broken on windows #$Date{zonedelta} = (strftime "%z", localtime)/100; $Date{zonedelta} = Astro_tzoffset(time)/100;