Register timestamp of zero crossing in accounts file
This commit is contained in:
parent
fa60e1081a
commit
4178009405
1 changed files with 9 additions and 3 deletions
|
@ -42,9 +42,15 @@ sub update {
|
|||
if (lc $a[0] eq lc $username) {
|
||||
$old = $a[1];
|
||||
$new = $old + $delta;
|
||||
printf {$out} "%-16s %+9.2f %s",
|
||||
$username, $new, now() or die $!;
|
||||
print {$out} "\n" or die $!;
|
||||
|
||||
my $since = $a[3] // "";
|
||||
$since = "+\@" . now() if $new > 0 and (!$since or $old <= 0);
|
||||
$since = "-\@" . now() if $new < 0 and (!$since or $old >= 0);
|
||||
$since = "0\@" . now() if $new == 0 and (!$since or $old != 0);
|
||||
|
||||
printf {$out} "%-16s %+9.2f %s %s\n", (
|
||||
$username, $new, now(), $since
|
||||
) or die $!;
|
||||
} else {
|
||||
print {$out} $line or die $!;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue