2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

92_FileLog.pm: add some more decimals to avg (Forum #106672)

git-svn-id: https://svn.fhem.de/fhem/trunk@20825 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-12-25 18:52:45 +00:00
parent c2c3e738c9
commit 0072f0eea3

View File

@ -1064,7 +1064,12 @@ RESCAN:
my $j = $i+1;
$data{"min$j"} = $min[$i];
$data{"max$j"} = $max[$i];
$data{"avg$j"} = $cnt[$i] ? sprintf("%0.1f", $sum[$i]/$cnt[$i]) : 0;
if($cnt[$i]) {
my $a = $sum[$i]/$cnt[$i];
$data{"avg$j"} = sprintf("%0.*f", ($a<=1 ? 3 : ($a <= 10 ? 2 : 1)), $a);
} else {
$data{"avg$j"} = 0;
}
$data{"sum$j"} = $sum[$i];
$data{"cnt$j"} = $cnt[$i];
$data{"currval$j"} = $lastv[$i];