3 unstable releases
0.2.0 | Jul 30, 2021 |
---|---|
0.1.1 | Jun 22, 2021 |
0.1.0 | Jun 20, 2021 |
#421 in Date and time
21KB
371 lines
duration-breakdown
Breakdowns of durations of time into their constituent parts of various units.
Example
use duration_breakdown::DurationBreakdown;
use std::time::Duration;
let breakdown = DurationBreakdown::from(Duration::new(12_345_678, 1234));
assert_eq!(
breakdown.to_string(),
"20 weeks, 2 days, 21 hours, 21 minutes, 18 seconds, and 1234 nanoseconds");
lib.rs
:
This crate breaks down durations of time into their constituent parts of various units (weeks, days, hours, minutes, seconds, and nanoseconds).
This can be used to convert a duration such as 10,000 seconds into the following form: 0 weeks, 0 days, 2 hours, 46 minutes, 40 seconds, and 0 nanoseconds.
Examples
use duration_breakdown::DurationBreakdown;
use std::time::Duration;
let breakdown = DurationBreakdown::from(Duration::new(12_345_678, 1234));
assert_eq!(
breakdown.to_string(),
"20 weeks, 2 days, 21 hours, 21 minutes, 18 seconds, and 1234 nanoseconds");