-
Notifications
You must be signed in to change notification settings - Fork 61
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
std::time replacement for wasm #449
Conversation
Uses of std::time:
https://doc.rust-lang.org/std/time/struct.Instant.html - opaque nondecreasing clock, only useful with Duration The web platform has performance.now(), returning milliseconds increasing at a constant rate, not limited to ms-precision (floating-point allows up to µs precision, but Firefox at least rounds to 1 ms). Sounds exactly like what we want for Instant and Duration. Found this crate, a drop-in replacement (would be nice if these crates could override There's also https://lib.rs/crates/wasm-timer for std::time::Instant and futures-timer (tokio-timer on native). https://lib.rs/search?q=wasm+std This looks promising too: https://lib.rs/crates/wasm_thread "An std thread replacement for wasm32 target" |
…me as std::time, for cleaner importing
Although there's an open pull request to the `instant` crate to support SystemTime and UNIX_EPOCH (sebcrozet/instant#9), it is simpler to change ui/logo to simply use Instant and Duration.
The wasm32-unknown-unknown target does not support std::time, will need to find a replacement for 🕸️ Web support #446