Blog post: std time

https://blog.yoshuawuyts.com/std-time/

2 Likes

The current Debug implementation for Duration seems fine to me

let now = Instant::now();
thread::sleep(Duration::from_secs(2));
dbg!(now.elapsed());
[src/main.rs:9] now.elapsed() = 2.00014259s

I’m not sure if it would be appropriate for Duration to implement Display, if it exceeds 1 minute should it start dividing the time down into larger units than it stores? Keeping these decisions for a more UI focused type as provided by chrono or another library makes sense to me.

5 Likes

Ooops, you’re entirely right – I missed that. Updated the post to reflect it already exists (:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.