mirror of
https://github.com/rwxrob/dot
synced 2024-11-18 15:25:52 +00:00
16 lines
397 B
Plaintext
16 lines
397 B
Plaintext
|
#!/usr/bin/env bash
|
||
|
seconds="$1"
|
||
|
[[ -z "$seconds" ]] && echo "usage: $0 SECONDS" && exit 1
|
||
|
days=$((seconds/86400))
|
||
|
out=""
|
||
|
(( days > 0 )) && out="${days}."
|
||
|
(( seconds -= (days*86400) ))
|
||
|
hours=$((seconds/3600))
|
||
|
(( hours > 0 )) && out+="${hours}."
|
||
|
(( seconds -= (hours*3600) ))
|
||
|
minutes=$((seconds/60))
|
||
|
(( minutes > 0 )) && out+="${minutes}."
|
||
|
(( seconds -= (minutes*60) ))
|
||
|
out+="$seconds"
|
||
|
echo "$out"
|