Skip to main content

format_duration

Function format_duration 

Source
pub fn format_duration(nanos: i64) -> String
Expand description

Format a physical duration (nanoseconds) as a compact human string — 1h30m, 500ms, 1.5s, 2d, -45m, 0s. Largest unit first; zero components omitted; sub-second fractions trimmed. The inverse of parse_duration. (This is a physical elapsed time, distinct from a calendar Span: it has no months — those aren’t a fixed number of nanoseconds.)