pub fn duration_approx(duration: Duration) -> (u64, &'static str)
Expand description
Returns given duration in approximate format: amount and unit.
- Amount is the number of full units, i.e. it’s not rounded.
- Unit can be
h
(hours),m
(minutes) ors
(seconds)
§Examples
use std::time::Duration;
assert_eq!(ml_progress::duration_approx(Duration::from_secs(234)), (3, "m"));