Function dia_time::smart_format_day_hms
source · pub fn smart_format_day_hms(duration: &Duration) -> String
Expand description
§If the duration is within a day, forwards to ::format_hms()
; otherwise, forwards to ::format_day_hms()
.
§Examples
use std::time::Duration;
use dia_time::{self, DAY, HOUR, MINUTE};
assert_eq!(
dia_time::smart_format_day_hms(&Duration::from_secs(HOUR * 2 + MINUTE * 53 + 58)),
"02:53:58"
);
assert_eq!(
dia_time::smart_format_day_hms(&Duration::from_secs(DAY * 9 + HOUR * 2 + MINUTE * 53 + 58)),
"9d, 02:53:58"
);