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