-
Notifications
You must be signed in to change notification settings - Fork 538
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
Completely migrate to core::time::Duration #497
Comments
Hey, I'm pretty new to Rust and How would you represent negative durations under this proposal? |
I don't think a complete migration to There are advantages to having a more fully featured type for a date and time library. Allowing negative values is one. Other are that we can implement (de)serialization, formatting and parsing, and generally just have control over its implementation and API. |
Note that #1229 already added a bunch of support for using |
Interesting, I didn't know you were working on that in the standard library. |
Well, this is motivated by my day job work sharing me and my notions of not wanting to use So in my mind, our current direction is aligned with this issue. |
To be clear, I think there are some places in the API where we might still have a need for something like chrono's |
This would be ideal for usability of the
Duration
type, and promote more compatibility with other crates. It's been mentioned a few times over the years, and was a goal back in 2016.As back then, this would be a major breaking change and would need to be prepared for 0.5.
core::time::Duration
also doesn't have some of the utility methods likeoldtime::Duration::days
, which we might want to replace in some fashion.The main issue is
time::Duration
's lack of support for negative durations. This will force us to change a few APIs that return possibly-negative values. It'd be good to review which APIs will change before working on the implementation.The text was updated successfully, but these errors were encountered: