Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Documentation] Comparison with time and chrono crates? #221

Closed
saona-raimundo opened this issue Apr 14, 2023 · 2 comments · Fixed by #233
Closed

[Documentation] Comparison with time and chrono crates? #221

saona-raimundo opened this issue Apr 14, 2023 · 2 comments · Fixed by #233
Assignees

Comments

@saona-raimundo
Copy link

Hi! Thanks for the crate!

Would you consider adding a comparison with the popular time and chrono crates?

@ChristopherRabotin
Copy link
Member

That's a good idea. My experience with chrono and time are limited because I have not had the use for them for years, relying only on hifitime.

Off the cuff, I would say that hifitime is more feature complete and more correct: like chrono and time, it can parse date times with and without time zones, but hifitime also handle time systems (thereby supporting specific cases of time dilation). Hifitime also has the concept of Duration exposed to users, allowing for stuff like Epoch::now() + Unit.Hours * 2.3, as well as [rounding to the nearest unit]https://docs.rs/hifitime/latest/hifitime/prelude/struct.Epoch.html#method.round) , or floor and ceil.
Hifitime also provides time based iterations with TimeSeries: that's very convenient when building interpolations or just ensuring that you're computing some function at a set interval without fears of f64 rounding your data.

The main possible limitation I have in mind is that I think chrono has a way to format epoch so they can be understood by database natively: I don't suspect that to be too difficult, but I haven't looked into it. The chrono-tz crate also allows parsing with named time zones (but not serializing with those named time zones): hifitime cannot do that.

Somewhat of another limitation is that chrono and time (I think) support time-only stuff: you can't do that with hifitime, you must specify a year, month, and day. But you can set an Epoch's time using with_hms and with_hms_strict, or copy it from another Epoch with_hms_from.

Overall then, hifitime is more precise, has more features that most users need, and can be used for scientific applications.

@saona-raimundo
Copy link
Author

Yeah, I think there are very good things in hifitime!

Just looking at the documentation of time, there are features to take some random times.
Also, there is quickcheck-based testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants