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

getting utc in wasm #243

Closed
jaroslaw-weber opened this issue May 2, 2018 · 10 comments
Closed

getting utc in wasm #243

jaroslaw-weber opened this issue May 2, 2018 · 10 comments

Comments

@jaroslaw-weber
Copy link

Is there a workaround for making chrono work with wasm? I want to get current time (utc). I am using wasm-unknown-unknow flag.

@quodlibetor
Copy link
Contributor

What is the error that you're running into? I haven't done any work with it, but running with no-default-features might help you out.

@ablwr
Copy link

ablwr commented May 6, 2018

I'm having this problem as well, and this user reporting in the time repo gets the same errors as I do: time-rs/time#163

@CryZe
Copy link
Contributor

CryZe commented May 7, 2018

I'd like to see some wasm support as well. While disabling the local feature should work, it doesn't work for crates that have to work on other targets as well, due to cargo not being able to selectively enable / disable features for certain targets. So it would be cool if chrono either had specific wasm support (by using Web APIs or defining its own external interface) or just automatically cfging out the local feature when targeting wasm. If not, I might have to fork chrono :(

@CryZe
Copy link
Contributor

CryZe commented May 7, 2018

Would it be if I would just send a PR real quick that extends all the local cfgs to also check for wasm? That'd be a fast and easy, but slightly dirty fix (although somewhat necessary for the meantime).

@quodlibetor
Copy link
Contributor

@CryZe yes I'd be curious what that looks like, if it's backwards-compatible I'd be happy with it.

@CryZe
Copy link
Contributor

CryZe commented May 7, 2018

Actually, that wouldn't work, as the time crate would still be pulled in then. Urgh, I guess someone needs to fix cargo then.

@quodlibetor
Copy link
Contributor

If you disable default features we should not be pulling in the time crate.

@jjpe
Copy link
Contributor

jjpe commented Nov 25, 2018

Is there a workaround for making chrono work with wasm? I want to get current time (utc). I am using wasm-unknown-unknow flag.

I have a PR waiting to be merged that enables Utc::now() and Local::now to work on WASM.

@David-OConnor
Copy link

Still broken

@quodlibetor
Copy link
Contributor

This is fixed.

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

No branches or pull requests

6 participants