Human duration

time_human_duration

Format a number of seconds as a human-readable duration string.

Example

time_human_duration 90061   # => "1 days 1 hours 1 minute(s) and 1 seconds"
time_human_duration 65      # => "1 minute(s) and 5 seconds"
time_human_duration 30      # => "30 seconds"

Arguments

  • $1 (int): Number of seconds

Exit codes

  • 0: Success; 2 Missing argument

Output on stdout

  • Human-readable duration