Simplify unit correction in gensens.

Remove limit of units having to be in powers of 10
by using a division by the unit incase it is not 0.
This commit is contained in:
Andreas Bachlechner 2021-09-27 17:52:02 +02:00
parent 41c14beba6
commit c2d2853d89
1 changed files with 1 additions and 3 deletions

View File

@ -153,9 +153,7 @@ sub gensens_update {
$val = <IN>;
$val = trim($val);
$unit = $gensens->{unit}->{$str} || 0;
$c = () = $unit =~ /0/g;
$val /= 10**$c if $unit > 1;
$val *= 10**$c if $unit > 0 && $unit < 1;
$val /= $unit if $unit != 0;
close(IN);
} else {
logger("$myself: ERROR: unable to open '$gensens->{desc}->{$str}'.");