Skip to content
Prev Previous commit
Next Next commit
following chrono/wasmbind convention
  • Loading branch information
youknowone committed Aug 8, 2024
commit d2a4a330f9a319a680584f966c45d56a89524f34
16 changes: 10 additions & 6 deletions vm/src/stdlib/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,20 @@ mod decl {
_time(vm)
}

#[cfg(any(
not(target_arch = "wasm32"),
target_os = "wasi",
not(feature = "wasmbind")
))]
#[cfg(not(all(
target_arch = "wasm32",
feature = "wasmbind",
not(any(target_os = "emscripten", target_os = "wasi"))
)))]
fn _time(vm: &VirtualMachine) -> PyResult<f64> {
Ok(duration_since_system_now(vm)?.as_secs_f64())
}

#[cfg(all(target_arch = "wasm32", not(target_os = "wasi"), feature = "wasmbind"))]
#[cfg(all(
target_arch = "wasm32",
feature = "wasmbind",
not(any(target_os = "emscripten", target_os = "wasi"))
))]
fn _time(_vm: &VirtualMachine) -> PyResult<f64> {
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
Expand Down