Skip to main content

format_duration

Function format_duration 

Source
pub fn format_duration(seconds: u64) -> String
Expand description

37s, 2m 5s, 1h 2m 3s: a duration the way the Python UI wrote it.

use shellgame::ui::screens::format_duration;

assert_eq!(format_duration(59), "59s");
assert_eq!(format_duration(125), "2m 5s");
assert_eq!(format_duration(3723), "1h 2m 3s");