Skip to main content

format_remaining

Function format_remaining 

Source
pub fn format_remaining(unix_secs: u64) -> String
Expand description

Format a relative-time string showing how long until unix_secs from now_unix(). Handles both future (in 1h 0m) and past (expired 5m ago) cases. Picks the largest sensible unit pair and rounds toward the nearest integer in each.

Uses full seconds internally so small intervals (a few minutes or less) don’t collapse to “0h” via truncating integer division.