mirror of https://github.com/rwxrob/dot
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
397 B
Bash
16 lines
397 B
Bash
#!/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"
|