Expand description
Human-readable duration
human-duration converts a std::time::Duration
to a human readable string.
Examples:
use human_duration::human_duration;
let duration = std::time::Duration::new(120, 30_000_000);
assert_eq!(human_duration(&duration), "2m 0s 30ms");
let duration = std::time::Duration::new(9000, 0);
assert_eq!(human_duration(&duration), "2h 30m 0s 0ms");
Functionsยง
- human_
duration - Takes a
std::time::Duration
and returns a formattedString
.