aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoel Galenson <jgalenson@google.com>2021-08-09 10:33:23 -0700
committerJoel Galenson <jgalenson@google.com>2021-08-09 10:33:23 -0700
commit0228b9e3fe227b08a1c43e7a6b712ea405a17e8c (patch)
tree6497382f249fbcdca1698acf20570e87816cea15 /src
parent04bd053b28a4d14ba1ea20ca455df3d843282165 (diff)
downloadinstant-0228b9e3fe227b08a1c43e7a6b712ea405a17e8c.tar.gz
Upgrade rust/crates/instant to 0.1.10
Test: make Change-Id: I9fea83cf980dd876681e3df3b076e1ffd6aafa96
Diffstat (limited to 'src')
-rw-r--r--src/wasm.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm.rs b/src/wasm.rs
index 986bbf6..57ea39c 100644
--- a/src/wasm.rs
+++ b/src/wasm.rs
@@ -128,11 +128,17 @@ pub fn now() -> f64 {
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
mod js {
extern "C" {
+ #[cfg(not(target_os = "emscripten"))]
pub fn now() -> f64;
+ #[cfg(target_os = "emscripten")]
+ pub fn _emscripten_get_now() -> f64;
}
}
// Make the unsafe extern function "safe" so it can be called like the other 'now' functions
#[cfg(not(any(feature = "wasm-bindgen", feature = "stdweb")))]
pub fn now() -> f64 {
- unsafe { js::now() }
+ #[cfg(not(target_os = "emscripten"))]
+ return unsafe { js::now() };
+ #[cfg(target_os = "emscripten")]
+ return unsafe { js::_emscripten_get_now() };
}