Function dia_time::smart_format_day_hms_ms[][src]

pub fn smart_format_day_hms_ms(duration: &Duration) -> String

If the duration is within a day, forwards to ::format_hms_ms(); otherwise, forwards to ::format_day_hms_ms().

Examples

use std::time::Duration;
use dia_time::{self, DAY, HOUR, MINUTE};

assert_eq!(
    dia_time::smart_format_day_hms_ms(&Duration::from_secs(HOUR * 2 + MINUTE * 53 + 58)),
    "02:53:58.000"
);
assert_eq!(dia_time::smart_format_day_hms_ms(&Duration::from_secs(DAY * 9 + HOUR * 2 + MINUTE * 53 + 58)), "9d, 02:53:58.000");