Skip to content

Commit

Permalink
Display milliseconds for low elapsed times.
Browse files Browse the repository at this point in the history
Addresses console-rs#597
  • Loading branch information
lgarron committed Oct 6, 2023
1 parent 889084f commit cd53c35
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/format.rs
Original file line number Diff line number Diff line change
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 cd53c35

Please sign in to comment.