-
Notifications
You must be signed in to change notification settings - Fork 537
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
Optionally remove time crate dependency #137
Conversation
Ping. What would it take to get this merged? |
I had been busy finishing and publishing Kailua for recent weeks. Sorry for delay! I'm pretty okay to make |
src/offset/utc.rs
Outdated
@@ -4,11 +4,14 @@ | |||
//! The UTC (Coordinated Universal Time) time zone. | |||
|
|||
use std::fmt; | |||
#[cfg(feature="local")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be #[cfg(not(feature="local"))]
?
In which case, UTC::now() needs to be changed to get the current time without using oldtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this is correct. With the local feature enabled, we have extern crate time as oldtime
in the crate root. This is needed to get the current time. With UTC::today
and UTC::now
cfged-out, this import is not used.
How about making the time crate dependency optional, and if the time crate isn't provided, define a chrono::Duration struct that allows negative durations (and probably has a similar API to time::Duration)? It's unfortunate chrono has a dependency on time just for the definition of a single struct. |
That's pretty much exactly what this PR is? @lifthrasiir already said he doesn't want to use that definition.
That's not quite true, it also uses the time crate to get the current time and figure out what the local timezone is. See |
I originally intended to merge this PR in 0.4.0, but it is now slightly delayed to 0.4.1 due to the request to make 0.4.0 available ASAP. |
If I rebase this, will you merge it? |
Can we get this merged in some way? The wasm-unknown-unknown target can't really use chrono otherwise. |
I'd like to put a big 👍 on getting this fixed. I outlined the issues I had with |
+1 would also love to see this! I'm experimenting with isomorphic Rust (server + wasm) and would very much like to use Let me know if I can do anything to help 😄 |
@jethrogb We can potentially rebase this for you so this moves ahead faster if you want. There's a lot of interest in seeing this merged now. |
@CryZe I can rebase it myself no problem. I'm just waiting for a statement from the maintainer that if and when I do, it will get merged. |
Sorry, yes, @lifthrasiir has expressed string opposition to merging this, and this is their project. |
@quodlibetor can you elaborate on the "strong opposition"? Where was this expressed? Last statement from @lifthrasiir was “I originally intended to merge this PR ...”. I'm happy to make changes as requested, but there is no actual proposal on how to change this PR to suit the maintainer's wishes. Note this PR is pretty much a prerequisite for |
My understanding (from this comment and this comment in another issue)was that @lifthrasiir wants to replace |
@jethrogb I've been made a release manager for the chrono org, if you rebase this I'll re-review it with the intention of merging it. My biggest request at this point would be for you to enhance the commit messages a bit:
Other than that I think that the fact that this is all behind feature flags means that we can let the good beat out the perfect for at least a little while longer. |
Also, just to be clear, I'd love to get clippy working in no-std as full-featured as possible. I'm not at all invested in the embedded space so I'm not sure what that would look like, but almost the only allocations we require are parsing format strings and outputting the results of format strings, so given a |
Rebased and made requested changes. Open questions from original PR remain. |
|
Agreed on naming the feature
The doctests rely on code that doesn't exist if you don't use the |
Updated feature name |
Ah, I see we're not running with cc #236 |
I would like to use the chrono crate to process time information on systems that don't have a clock. The time crate, which is used by chrono to obtain and represent the local time, can't be made to work on such a system. This PR adds a default-enabled "local" feature to the crate and moves all code that is dependent on the time crate behind a cfg-gate. Current users of chrono need to do nothing. Users of chrono that would like to use it without the time crate can set
default-features = false
in their Cargo.toml.Open questions:
UTC::now
andUTC::today
also depend on the time crate. I have put them behind the same cfg-gate, but that might be a misnomer. We could leave this as is, or I could add another feature with a different name or rename the current feature.