Add seconds2chapter script
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
fd63efc409
commit
47e20c502c
1 changed files with 17 additions and 0 deletions
17
bin/seconds2chapter
Executable file
17
bin/seconds2chapter
Executable 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[*]}"
|
Loading…
Reference in a new issue