From cd53c35ff8133166119d98e727ffbccc59f6dee6 Mon Sep 17 00:00:00 2001 From: Lucas Garron Date: Fri, 6 Oct 2023 14:32:56 -0700 Subject: [PATCH] Display milliseconds for low `elapsed` times. Addresses https://github.com/console-rs/indicatif/issues/597 --- src/format.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/format.rs b/src/format.rs index 7475a251..c02cdb11 100644 --- a/src/format.rs +++ b/src/format.rs @@ -3,6 +3,7 @@ use std::time::Duration; use number_prefix::NumberPrefix; +const MILLISECOND: Duration = Duration::from_millis(1); const SECOND: Duration = Duration::from_secs(1); const MINUTE: Duration = Duration::from_secs(60); const HOUR: Duration = Duration::from_secs(60 * 60); @@ -104,6 +105,7 @@ const UNITS: &[(Duration, &str, &str)] = &[ (HOUR, "hour", "h"), (MINUTE, "minute", "m"), (SECOND, "second", "s"), + (MILLISECOND, "millisecond", "ms"), ]; impl fmt::Display for HumanBytes {