Skip to content

Time

Index

time::calc_elapsed

Print a human-readable elapsed time string (e.g. "1h 2m 3s") for a seconds interval. Output: stdout — elapsed time in "Xh Xm Xs" format (hours and minutes omitted when zero)

Arguments

  • $1 (start): time in seconds (e.g. from $SECONDS or date +%s)
  • $2 (end): time in seconds

time::shell_elapsed_time

Print the elapsed time since the current shell session started (using $SECONDS). Output: stdout — elapsed time in "Xh Xm Xs" format shellcheck disable=SC2120 # called with no args by callers, shellcheck can't see all call sites

Function has no arguments.