rwxrob-dot/scripts/sec2dur
2022-02-14 23:36:21 -05:00

11 lines
319 B
Bash
Executable File

#!/usr/bin/env bash
seconds="$1"
[[ -z "$seconds" ]] && echo "usage: $0 SECONDS" && exit 1
days=$((seconds/86400))
(( seconds -= (days*86400) ))
hours=$((seconds/3600))
(( seconds -= (hours*3600) ))
minutes=$((seconds/60))
(( seconds -= (minutes*60) ))
printf "%i.%02i.%02i.%02i" "$days" "$hours" "$minutes" "$seconds"