-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Create a more robust date/time crate #14657
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
Comments
https://github.com/mozilla/rust/wiki/Lib-datetime and https://mail.mozilla.org/pipermail/rust-dev/2013-September/005528.html provide a detailed analysis of what a proper datetime library should look like. http://blog.joda.org/2009/11/why-jsr-310-isn-joda-time_4941.html?m=1 explains shortcomings of jodatime. |
cc @luisbg |
@cmr do you want help with this? |
@luisbg I think I'll be able to, yes. |
Maybe cloning JSR-310 which is implemented in Java 8 is more approriate? It is made by the same people learning on mistakes made when creating Joda-Time, as they stated themselves (the link provided by @cmr). |
I'd seriously recommend basing it on JSR-310 rather than JodaTime. Note that there are some extras that 310 had that got stripped out of Java 8. See http://threeten.org. |
On Hackernews the concern was raised that duplicating APIs might give trouble: http://www.reuters.com/article/2014/05/09/us-oracle-google-ruling-idUSBREA480KQ20140509 |
After me research and the opinion of other people who joined the discussion, we agreed that JSR-310 was a better basis to work from. I don't think a similar API is a problem when JSR-310 is under the BSD license. |
@jodastephen is: A. The author of JodaTime (And I think that @ ing someone lets them know?) |
(yup, @-mention will send them a notification) It'd be very nice to have a domain expert lending a hand, even if it's just for guidance! |
I'm happy to answer questions on JSR-310. The key is the separations it has between local date/time, zoned date/time and instants. Those distinct types allow developers to model their domains accurately and effectively. Other parts of JSR-310 (the chrono and temporal package) could be adopted as is, but there may be a better way in a different programming language. If you want to avoid license issues, look at the source code for ThreeTen/threetenbp which is the BSD fork from code pre-OpenJDK.. |
Thanks, @jodastephen. On the subject of licensing I did want to mention that everybody involved needs to avoid doing direct ports of copyleft code to Rust. Implement API's; don't copy code. Use the BSD repo @jodastephen mentioned and not the (presumably GPL) OpenJDK code for reference. I have no idea how the new precedents about API copyright might apply in cross-language situations, but I'm guessing a Rust API is going to necessarily look somewhat different from a Java one. |
I've been doing some thinking about this, and I've been writing code at such a slow pace that I don't have it in a repository just yet, but there are a number of ways that Rust language features would make the API differ from a Java implementation:
I'm currently waiting on a date/time crate for my personal project, which was why I started thinking about this, so I'd be happy to contribute to whatever comes up. |
I only got started with this but it might be worth mentioning: |
FYI, #11189 needs a ns-precision duration type for I/O timers. If such a data type already exists in one of these libraries we might want to consider how to integrate just that piece. |
I suppose this has nothing to do with this lib: https://github.com/depp/datetime-rs |
So whatever happened with providing some usable date/time functions? Can we at least have an agreed internal representation of time/date, to which operations can later be added? |
OK, thanks. That should be mentioned at the Rust wiki. |
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#619 |
It lacks date parsing functions. This is documented ("Advanced offset handling and date/time parsing is not yet supported (but is planned).") I happen to need RFC 822 date parsing ("Tue, 20 Jan 2015 17:35:20 -0800") but others may need other formats. |
@John-Nagle If you are interested, please participate to chronotope/chrono#12. |
Sorry guys. I got very busy with interviews and a new job, and I couldn't finish my work on rust-datetime. Hopefully it can serve as a base or reference for future development in this topic. |
… r=Veykril Revert "Handle dev-dependency cycles" Reverts rust-lang/rust-analyzer#14475 I managed to fix the problem that causes the metric failures, but this still severely degrades IDE features in a way that makes the user experience ***worse*** than before. I am not sure how to address this, I wonder what the jetbrains plugin is doing in these cases.
Just clone JodaTime. Start out of tree.
The text was updated successfully, but these errors were encountered: