3 ms·
I'm still not sure what crate I should use for time between time and chrono, and searching the internet gives me conflicting information: This site says about
by Sphax 4y ago
I'm still not sure what crate I should use for time between time and chrono, and searching the internet gives me conflicting information:
This site says about the time crate: "The original datetime crate which was split out of std pre-rust-1.0"
but as far as I can tell the time crate as it is now is not the original crate and is maintained.
The book zero2prod uses chrono.
What's the recommended crate to use for time today ?
- k__ 4y agoMaybe, both are okay and it's just a matter of taste?
- conradludgate 4y agoBoth are maintained and fairly equivalent in API. chrono is getting an upgrade soon in 0.5 that should make it slightly easier to use too. I've made some PRs recently to chrono, the new maintainer is very good
- dochtman 4y agoYes, the time crate was rebooted after 0.1 and got a new maintainer. I think we're starting to do better again with Chrono, hopefully it won't take us too long to get out a solid 0.5 release. (I'm one of the current Chrono maintainers -- the previous maintainer burnt out on the project earlier this year, at which point the project sorely needed some TLC.)
- nicoburns 4y agoDo you think there's any possibility of `time` and `chrono` merging at some point? (or one depending on the other and providing a superset of functionality). It's rather confusing having two de-facto datetime libraries in the Rust ecosystem, and as far as I can see there isn't any major difference in philosophy or scope between the two libraries?
- dochtman 4y agoOne depending on the other seems like the worst of both worlds: more code to compile for everyone. Personally I still prefer chrono's API; chrono is also much more conservative about the MSRV (currently at 1.38) whereas time consistently bumps to N - 3, which seems like a meaningful difference. time depends on the libc timezone parsing with some fairly involved workarounds to avoid hitting undefined behavior, while we incorporated time zone parsing in Rust with some caching for chrono. So I think these are meaningful differences -- feels unlikely that these projects will merge.
- Sphax 4y agoThanks for the information. If both are now maintained I'll probably just try both crate and see which one I prefer.