Advertisement
Skillkiller

Display Secods as Time

Feb 2nd, 2019
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. function displaytime {
  2.   local T=$1
  3.   local D=$((T/60/60/24))
  4.   local H=$((T/60/60%24))
  5.   local M=$((T/60%60))
  6.   local S=$((T%60))
  7.   (( $D > 0 )) && printf '%d Tage ' $D
  8.   (( $H > 0 )) && printf '%d Stunden ' $H
  9.   (( $M > 0 )) && printf '%d Minuten ' $M
  10.   (( $D > 0 || $H > 0 || $M > 0 )) && printf 'und '
  11.   printf '%d Sekunden\n' $S
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement