Add seconds2chapter script

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-08-28 01:37:28 +02:00
parent fd63efc409
commit 47e20c502c
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

17
bin/seconds2chapter Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
source ~/bin/script_framework.sh
ts=${1:-}
[[ -n $ts ]] || fatal "Usage: ${0##*/} <timestamp, i.e. 12226>"
pts=()
for div in 3600 60 1; do
pt=$(( ts / div ))
ts=$(( ts % div ))
pts+=(${pt})
done
IFS=':'; echo "${pts[*]}"