Guest User

Untitled

a guest
Jan 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Usage:
  4. # fmt_time SECONDS
  5. #
  6. # Examples:
  7. # $ fmt_time 90
  8. # 0:01:30
  9. #
  10. # $ fmt_time $((60 * 60))
  11. # 1:00:00
  12. #
  13. # $ fmt_time $((60 * 60 * 24 * 400))
  14. # 400 days, 0:00:00
  15. #
  16.  
  17. fmt_time() { python -c "import datetime; print datetime.timedelta(seconds=$1)"; }
  18.  
  19. [[ $BASH_SOURCE = $0 ]] && fmt_time "$1"
Add Comment
Please, Sign In to add comment