Skip to content

Commit

Permalink
Display milliseconds for elapsed below 1 second.
Browse files Browse the repository at this point in the history
Addresses #597
  • Loading branch information
lgarron committed Oct 6, 2023
1 parent 889084f commit c345265
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/format.rs
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c345265

Please sign in to comment.