mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-13 03:05:34 +00:00
DST change fixes
git-svn-id: https://svn.fhem.de/fhem/trunk@614 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
1d8e3022c7
commit
4890c09886
@ -583,3 +583,4 @@
|
||||
- feature: CUL: optional baudrate spec in definition
|
||||
- feature: CUL: sendpool attribute
|
||||
- feature: CUL_HOERMANN module added
|
||||
- bugfix: DST change: absolute at and relative sunrise fix
|
||||
|
@ -53,7 +53,7 @@ at_Define($$)
|
||||
$nt -= ($lt[2]*3600+$lt[1]*60+$lt[0]) # Midnight for absolute time
|
||||
if($rel ne "+");
|
||||
$nt += ($hr*3600+$min*60+$sec); # Plus relative time
|
||||
$nt += 86400 if($ot >= $nt); # Do it tomorrow...
|
||||
$nt += SecondsTillTomorrow($ot) if($ot >= $nt); # Do it tomorrow...
|
||||
$nt += $at_tdiff if(defined($at_tdiff));
|
||||
|
||||
@lt = localtime($nt);
|
||||
|
@ -67,11 +67,11 @@ sr($$$$$$)
|
||||
if($data{AT_RECOMPUTE} || # compute it for tommorow
|
||||
int(($nh-$sst)*3600) >= 0) { # if called a subsec earlier
|
||||
$nt += 86400;
|
||||
$diff = 24;
|
||||
@lt = localtime($nt);
|
||||
$gmtoff = _calctz($nt,@lt); # in hour
|
||||
my $ngmtoff = _calctz($nt,@lt); # in hour
|
||||
$diff = 24+$gmtoff-$ngmtoff;
|
||||
|
||||
($rt,$st) = _sr($needrise,$needset, $lt[5]+1900,$lt[4]+1,$lt[3], $gmtoff);
|
||||
($rt,$st) = _sr($needrise,$needset, $lt[5]+1900,$lt[4]+1,$lt[3], $ngmtoff);
|
||||
$sst = ($rise ? $rt : $st) + ($seconds/3600);
|
||||
}
|
||||
|
||||
|
25
fhem/fhem.pl
25
fhem/fhem.pl
@ -64,6 +64,7 @@ sub OpenLogfile($);
|
||||
sub PrintHash($$);
|
||||
sub ResolveDateWildcards($@);
|
||||
sub RemoveInternalTimer($);
|
||||
sub SecondsTillTomorrow($);
|
||||
sub SemicolonEscape($);
|
||||
sub SignalHandling();
|
||||
sub TimeNow();
|
||||
@ -159,13 +160,15 @@ my $nextat; # Time when next timer will be triggered.
|
||||
my $intAtCnt=0;
|
||||
my %duplicate; # Pool of received msg for multi-fhz/cul setups
|
||||
my $duplidx=0; # helper for the above pool
|
||||
my $cvsid = '$Id: fhem.pl,v 1.103 2010-03-22 14:31:37 rudolfkoenig Exp $';
|
||||
my $cvsid = '$Id: fhem.pl,v 1.104 2010-04-02 14:20:53 rudolfkoenig Exp $';
|
||||
my $namedef =
|
||||
"where <name> is either:\n" .
|
||||
"- a single device name\n" .
|
||||
"- a list seperated by komma (,)\n" .
|
||||
"- a regexp, if contains one of the following characters: *[]^\$\n" .
|
||||
"- a range seperated by dash (-)\n";
|
||||
my $stt_sec; # Used by SecondsTillTomorrow()
|
||||
my $stt_day; # Used by SecondsTillTomorrow()
|
||||
|
||||
|
||||
$init_done = 0;
|
||||
@ -2215,3 +2218,23 @@ AddDuplicate($$)
|
||||
$duplicate{$duplidx}{TIM} = gettimeofday();
|
||||
$duplidx++;
|
||||
}
|
||||
|
||||
sub
|
||||
SecondsTillTomorrow($) # 86400, if tomorrow is no DST change
|
||||
{
|
||||
my $t = shift;
|
||||
my $day = int($t/86400);
|
||||
|
||||
if(!$stt_day || $day != $stt_day) {
|
||||
my $t = $day*86400+12*3600;
|
||||
my @l1 = localtime($t);
|
||||
my @l2 = localtime($t+86400);
|
||||
$stt_sec = 86400+
|
||||
($l1[2]-$l2[2])*3600+
|
||||
($l1[1]-$l2[1])*60;
|
||||
$stt_day = $day;
|
||||
}
|
||||
|
||||
return $stt_sec;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user