rwxrob-dot/snippets/bash/sec2hour
Rob Muhlestein 2ea0289e9f Rebase
2022-02-09 02:29:05 -05:00

11 lines
254 B
Plaintext

sec2hr () {
local sec="$1"
local hours=$(( "${sec}" / 3600 ))
local remainder=$(( "${sec}" % 3600))
local minutes=$(( "${remainder}" / 60 ))
local seconds=$(( "${sec}" % 60))
printf "%02d:%02d:%02d\n" "${hours}" "${minutes}" "${seconds}"
}