We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Instant
1 parent b66e140 commit 09d64b0Copy full SHA for 09d64b0
src/time.rs
@@ -130,7 +130,7 @@ impl From<Instant> for ::std::time::SystemTime {
130
131
impl fmt::Display for Instant {
132
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
133
- write!(f, "{}.{}s", self.secs(), self.millis())
+ write!(f, "{}.{:0>3}s", self.secs(), self.millis())
134
}
135
136
@@ -361,8 +361,9 @@ mod test {
361
362
#[test]
363
fn test_instant_display() {
364
+ assert_eq!(format!("{}", Instant::from_millis(74)), "0.074s");
365
assert_eq!(format!("{}", Instant::from_millis(5674)), "5.674s");
- assert_eq!(format!("{}", Instant::from_millis(5000)), "5.0s");
366
+ assert_eq!(format!("{}", Instant::from_millis(5000)), "5.000s");
367
368
369
0 commit comments