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.
rwxrob-dot/scripts/sec2dur

11 lines
319 B
Plaintext

2 years ago
#!/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"