Skip to main content

Module elapsed

Module elapsed 

Source
Expand description

Shared user-visible elapsed/duration formatter.

Every TUI, workflow, Fleet, sub-agent, task/activity, toast, status, and receipt surface renders durations through these helpers so the grammar stays consistent everywhere: 0s, 42s, 1m 05s, 12m 34s.

Rules:

  • Whole seconds under a minute render bare (0s, 59s).
  • At one minute and above the seconds zero-pad (60s -> 1m 00s, 61s -> 1m 01s).
  • Minutes keep growing past 60 (3600s -> 60m 00s); no hours unit is introduced, so a large value can never be misread at the wrong scale.
  • Sub-second values render as milliseconds (350ms) so a fast receipt never rounds down to a misleading 0s.

Display copy only: timeout/config input units, persisted values, and machine-readable fields stay in their original units; this module exists solely to render durations for humans.

Functionsยง

format_elapsed_ms
Format a millisecond duration for a user-visible indicator.
format_elapsed_secs
Format a whole-seconds duration for a user-visible indicator.