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

Support for wasm32-wasi #352

Closed
CryZe opened this issue Oct 21, 2019 · 8 comments · Fixed by #365
Closed

Support for wasm32-wasi #352

CryZe opened this issue Oct 21, 2019 · 8 comments · Fixed by #365
Labels

Comments

@CryZe
Copy link
Contributor

CryZe commented Oct 21, 2019

It seems like wasm32-wasi isn't supported, but could very easily be supported by chrono (although I don't quite know what the situation with the time crate is nowadays).

@quodlibetor
Copy link
Contributor

In what way exactly is wasm32-wasi not supported?

@CryZe
Copy link
Contributor Author

CryZe commented Nov 24, 2019

The clock APIs (dates and co.) are directly supported through syscalls / libc on WASI unlike with wasm32-unknown-unknown. In fact most of Rust‘s std even fully works. iirc chrono‘s clock feature does not work on WASI because the time crate doesn‘t know about WASI, so it handles it the same way as the normal unknown target.

@CryZe
Copy link
Contributor Author

CryZe commented Nov 25, 2019

This is what I'm doing as a workaround: https://github.com/LiveSplit/livesplit-core/blob/2057b3a3828bd0a2469d96b1f9713bf3f9a2e23b/src/platform/wasm/wasi/mod.rs#L9-L17

Basically since SystemTime in std works, you can just get the unix timestamp and thus a DateTime from there.

@quodlibetor
Copy link
Contributor

Interesting. I'll try and set up a wasm-wasi test or definitely accept a PR adding one, and then we can flip some cfg flags to make this all work.

@quodlibetor
Copy link
Contributor

if you (or anyone) wants to work on this feel free to assign it to yourself! I'll assign to myself when I start work, which probably won't be this week.

@coolreader18
Copy link
Contributor

I can try working on this; it's relevant to a project I'm working on.

@quodlibetor
Copy link
Contributor

There are a few more things before we actually want this to be closed:

  • support for now() in wasi
  • adding a test to CI that verifies that now() works in wasi.

Anyone should feel free to assign this to themselves and start working on either part of that!

@pitdicker
Copy link
Collaborator

We have support for now() from the standard library, and #1237 added wasm32-wasi to the CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants