[−][src]Function dia_time::smart_format_dhms
pub fn smart_format_dhms(duration: &Duration) -> String
If the duration is within a day, forwards to ::format_hms()
; otherwise, forwards to ::format_dhms()
.
Examples
use std::time::Duration; use dia_time::{self, DAY, HOUR, MINUTE}; assert_eq!( dia_time::smart_format_dhms(&Duration::from_secs(HOUR * 2 + MINUTE * 53 + 58)), "02:53:58" ); assert_eq!( dia_time::smart_format_dhms(&Duration::from_secs(DAY * 9 + HOUR * 2 + MINUTE * 53 + 58)), "9d, 02:53:58" );