duration_approx

Function duration_approx 

Source
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) or s (seconds)

§Examples

use std::time::Duration;
assert_eq!(ml_progress::duration_approx(Duration::from_secs(234)), (3, "m"));