Use wasm32 cfg flag for kvs (#3131)
Co-authored-by: Emmanuel Keller <emmanuel.keller@surrealdb.com> Co-authored-by: Tobie Morgan Hitchcock <tobie@surrealdb.com>
This commit is contained in:
parent
953e496e7d
commit
7e25b36765
1 changed files with 14 additions and 0 deletions
|
@ -1,7 +1,10 @@
|
||||||
use crate::dbs::node::Timestamp;
|
use crate::dbs::node::Timestamp;
|
||||||
use crate::sql;
|
use crate::sql;
|
||||||
use sql::Duration;
|
use sql::Duration;
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
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
|
// Traits cannot have async and we need sized structs for Clone + Send + Sync
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -103,3 +106,14 @@ impl Default for SystemClock {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use crate::kvs::clock::SystemClock;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn get_clock_now() {
|
||||||
|
let clock = SystemClock::new();
|
||||||
|
let _ = clock.now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue