mirror of
https://github.com/brmlab/BLIT.git
synced 2025-06-07 19:34:00 +02:00
15 lines
361 B
Bash
Executable file
15 lines
361 B
Bash
Executable file
#!/bin/bash
|
|
|
|
function displaytime {
|
|
local T=$1
|
|
local D=$((T/60/60/24))
|
|
local H=$((T/60/60%24))
|
|
local M=$((T/60%60))
|
|
local S=$((T%60))
|
|
[[ $D > 0 ]] && printf '%d days ' $D
|
|
[[ $H > 0 ]] && printf '%d hours ' $H
|
|
[[ $M > 0 ]] && printf '%d minutes ' $M
|
|
[[ $D > 0 || $H > 0 || $M > 0 ]] && printf 'and '
|
|
printf '%d seconds\n' $S
|
|
}
|
|
displaytime $1
|