-
Notifications
You must be signed in to change notification settings - Fork 533
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
Provide access to subsecond nanos in the public interface of Duration. #154
Comments
I don't intend to modify |
@lifthrasiir is there a public branch that I can track for the |
What is the state of this? I am working on implementing chrono support for the PyO3 Python bindings crate. Chrono's lacking Duration API artificially limits the size of Duration's that can be supported, which is unfortunate. |
@kangalioo I think adding it as a feature to chrono does not requires us to change the public interface. #542 |
Added in #1327. |
Thanks! I would vouch to re-open this issue though, because the second part of the issue is not part of #1327:
This specifically is what would be needed in pyo3 to support sub-second precision in the Python<->Rust conversion (code permalink) |
Please just file a new issue so we can track that request separately. |
Sorry, I missed that part of the first post. #1137 includes a |
The way the Duration struct is implemented, if there are more total nanoseconds represented than i64::MAX, it is impossible to see greater than millisecond precision on the outside despite that information being stored. It would be useful to have a method similar to std::time::Duration::subsec_nanos which can return only the number of nanoseconds past the nearest second.
Additionally, for interfacing with chrono, it would be useful to have a constructor to create a Duration from a number of whole seconds plus the additional nanoseconds similar to std::time::Duration::new to efficiently construct Duration objects with full precision.
The text was updated successfully, but these errors were encountered: