diff options
author | lonkaars <loek@pipeframe.xyz> | 2024-03-12 09:02:24 +0100 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2024-03-12 09:02:24 +0100 |
commit | d3b396b17602ad71a62cbc2eaf595a1d94579c4a (patch) | |
tree | 3be5e49c5d9081ac3de4cd34b64b47ada23e9a22 /core/lib | |
parent | e6c1cacb60010ec75e02cf72acf34278417670fd (diff) |
make state update atomic and clean up some code
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -16,3 +16,22 @@ err() { # debug: # bc() { tee /dev/stderr | /usr/bin/bc ; } +fmt_time() { + ss="$(echo "$1 / 1" | bc)" + mm="$(echo "$ss / 60" | bc)" + ss="$(echo "$ss % 60" | bc)" + hh="$(echo "$mm / 60" | bc)" + mm="$(echo "$mm % 60" | bc)" + _time_fmt +} + +_time_fmt() { # [HH:]MM:SS + [ $hh -gt 0 ] && printf '%02d:' $hh + printf "%02d:%02d\n" $mm $ss +} + +# _time_fmt() { # [HHh]MMmSSs +# [ $hh -gt 0 ] && printf '%02dh' $hh +# printf "%02dm%02ds\n" $mm $ss +# } + |