2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

Optimizing: get time once per event, and not for each FileLog definition once

git-svn-id: https://svn.fhem.de/fhem/trunk@3008 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-04-01 11:19:27 +00:00
parent a8e956a903
commit 71623f47bc
4 changed files with 5 additions and 4 deletions

View File

@ -58,7 +58,6 @@ at_Define($$)
if($rel ne "+"); if($rel ne "+");
$nt += ($hr*3600+$min*60+$sec); # Plus relative time $nt += ($hr*3600+$min*60+$sec); # Plus relative time
$nt += SecondsTillTomorrow($ot) if($ot >= $nt); # Do it tomorrow... $nt += SecondsTillTomorrow($ot) if($ot >= $nt); # Do it tomorrow...
@lt = localtime($nt); @lt = localtime($nt);
my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]); my $ntm = sprintf("%02d:%02d:%02d", $lt[2], $lt[1], $lt[0]);
if($rep) { # Setting the number of repetitions if($rep) { # Setting the number of repetitions
@ -76,7 +75,8 @@ at_Define($$)
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer($nt, "at_Exec", $hash, 0); InternalTimer($nt, "at_Exec", $hash, 0);
$hash->{STATE} = ($oldattr && $oldattr->{disable} ? "disabled" : ("Next: ".FmtTime($nt))); $hash->{STATE} = ($oldattr && $oldattr->{disable} ?
"disabled" : ("Next: ".FmtTime($nt)));
return undef; return undef;
} }

View File

@ -98,7 +98,7 @@ FileLog_Log($$)
my $n = $dev->{NAME}; my $n = $dev->{NAME};
my $re = $log->{REGEXP}; my $re = $log->{REGEXP};
my $max = int(@{$dev->{CHANGED}}); my $max = int(@{$dev->{CHANGED}});
my $tn = TimeNow(); my $tn = $dev->{TRIGGERTIME};
my $ct = $dev->{CHANGETIME}; my $ct = $dev->{CHANGETIME};
my $wrotesome; my $wrotesome;
my $fh = $log->{FH}; my $fh = $log->{FH};

View File

@ -192,7 +192,7 @@
to a X10 computer interface)</li> to a X10 computer interface)</li>
<div class="dist"></div> <div class="dist"></div>
<li>Some TV models from Samsung/Panasonic/LG) and amplifier (YAMAHA)</li> <li>Some TV models from Samsung/Panasonic/LG and amplifier (YAMAHA)</li>
<div class="dist"></div> <div class="dist"></div>
<li>More than one way to receive 1Wire sensor data or to switch 1wire actors. <li>More than one way to receive 1Wire sensor data or to switch 1wire actors.

View File

@ -2352,6 +2352,7 @@ DoTrigger($$@)
my @ntfyList = sort { $defs{$a}{NTFY_ORDER} cmp $defs{$b}{NTFY_ORDER} } my @ntfyList = sort { $defs{$a}{NTFY_ORDER} cmp $defs{$b}{NTFY_ORDER} }
grep { $defs{$_}{NTFY_ORDER} } keys %defs; grep { $defs{$_}{NTFY_ORDER} } keys %defs;
Log 5, "Notify loop for $dev $hash->{CHANGED}->[0]"; Log 5, "Notify loop for $dev $hash->{CHANGED}->[0]";
$hash->{TRIGGERTIME} = TimeNow(); # Optimize FileLog
foreach my $n (@ntfyList) { foreach my $n (@ntfyList) {
next if(!defined($defs{$n})); # Was deleted in a previous notify next if(!defined($defs{$n})); # Was deleted in a previous notify
my $r = CallFn($n, "NotifyFn", $defs{$n}, $hash); my $r = CallFn($n, "NotifyFn", $defs{$n}, $hash);