Function compound_duration::format_dhms
source · pub fn format_dhms<T: TryInto<usize> + TryFrom<usize> + BitAnd<Output = T>>(
seconds: T
) -> Stringwhere
<T as TryFrom<usize>>::Error: Debug,
<T as TryInto<usize>>::Error: Debug,
Expand description
Convert seconds to compound duration (days, hours, minutes, seconds)
Example:
use compound_duration::format_dhms;
use std::time::Instant;
let now = Instant::now();
// do something ...
println!("{}", format_dhms(now.elapsed().as_secs() as usize));
// 69d10h40m
println!("{}", format_dhms(6000000));