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 41790fb1aa
commit a4ca4ec361

View File

@@ -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;