Reduce flushing a little

git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@2409 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2013-01-03 13:03:10 +00:00
parent dd73b1b09f
commit 8b1aa5e472

View File

@@ -100,6 +100,9 @@ FileLog_Log($$)
my $max = int(@{$dev->{CHANGED}}); my $max = int(@{$dev->{CHANGED}});
my $tn = TimeNow(); my $tn = TimeNow();
my $ct = $dev->{CHANGETIME}; my $ct = $dev->{CHANGETIME};
my $wrotesome;
my $fh = $log->{FH};
for (my $i = 0; $i < $max; $i++) { for (my $i = 0; $i < $max; $i++) {
my $s = $dev->{CHANGED}[$i]; my $s = $dev->{CHANGED}[$i];
$s = "" if(!defined($s)); $s = "" if(!defined($s));
@@ -109,12 +112,14 @@ FileLog_Log($$)
FileLog_Switch($log); FileLog_Switch($log);
my $fh = $log->{FH};
print $fh "$t $n $s\n"; print $fh "$t $n $s\n";
$fh->flush; $wrotesome = 1;
$fh->sync if !($^O eq 'MSWin32'); #not implemented in Windows
} }
} }
if($wrotesome) {
$fh->flush;
$fh->sync if !($^O eq 'MSWin32'); #not implemented in Windows
}
return ""; return "";
} }
@@ -513,11 +518,11 @@ seekTo($$$$)
<ul> <ul>
<li><code>%d</code> day of month (01..31)</li> <li><code>%d</code> day of month (01..31)</li>
<li><code>%m</code> month (01..12)</li> <li><code>%m</code> month (01..12)</li>
<li><code>%Y</code> year (1970...) <li><code>%Y</code> year (1970...)</li>
<li><code>%w</code> day of week (0..6); 0 represents Sunday <li><code>%w</code> day of week (0..6); 0 represents Sunday</li>
<li><code>%j</code> day of year (001..366) <li><code>%j</code> day of year (001..366)</li>
<li><code>%U</code> week number of year with Sunday as first day of week (00..53) <li><code>%U</code> week number of year with Sunday as first day of week (00..53)</li>
<li><code>%W</code> week number of year with Monday as first day of week (00..53) <li><code>%W</code> week number of year with Monday as first day of week (00..53)</li>
</ul> </ul>
FHEM also replaces <code>%L</code> by the value of the global logdir attribute.<br> FHEM also replaces <code>%L</code> by the value of the global logdir attribute.<br>
Before using <code>%V</code> for ISO 8601 week numbers check if it is Before using <code>%V</code> for ISO 8601 week numbers check if it is