diff --git a/lib/src/kvs/clock.rs b/lib/src/kvs/clock.rs index d96b0c90..7bc21e98 100644 --- a/lib/src/kvs/clock.rs +++ b/lib/src/kvs/clock.rs @@ -1,7 +1,10 @@ use crate::dbs::node::Timestamp; use crate::sql; use sql::Duration; +#[cfg(not(target_arch = "wasm32"))] use std::time::{SystemTime, UNIX_EPOCH}; +#[cfg(target_arch = "wasm32")] +use wasmtimer::std::{SystemTime, UNIX_EPOCH}; // Traits cannot have async and we need sized structs for Clone + Send + Sync #[allow(dead_code)] @@ -103,3 +106,14 @@ impl Default for SystemClock { Self::new() } } + +#[cfg(test)] +mod tests { + use crate::kvs::clock::SystemClock; + + #[test] + fn get_clock_now() { + let clock = SystemClock::new(); + let _ = clock.now(); + } +}