Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wasm non-web usage of env::now (#123)
A wasm embedder that hasn't enabled the `web` feature will still get the `Instant::now()` function generated, even if they end up using a custom `now` function. After all, the compiler/link don't have runtime knowledge about how the program runs, so it could be that `ThreadProfiler::initialize` is never called, so the default value of `now_ns` that makes use of `Instant::now` could be called at any point. This changes the `now_ns` function so it's defined only using `Instant` for native target and wasm when web is enabled. In the other case, we assume this is never called and it's a programmer error because we don't have any time reporter. Fixes #118.
- Loading branch information