Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
expenses authored and wngr committed Sep 30, 2021
1 parent 8796d1c commit 858c708
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ cfg_if::cfg_if! {
}

#[cfg(any(
not(any(target_arch = "wasm32", target_arch = "asmjs")),
not(any(feature = "stdweb", feature = "wasm-bindgen"))
not(any(target_arch = "wasm32", target_arch = "asmjs")),
not(any(feature = "stdweb", feature = "wasm-bindgen"))
))]
#[cfg(feature = "now")]
pub use crate::native::SystemTime;

#[cfg(all(
any(target_arch = "wasm32", target_arch = "asmjs"),
any(feature = "stdweb", feature = "wasm-bindgen")
any(target_arch = "wasm32", target_arch = "asmjs"),
any(feature = "stdweb", feature = "wasm-bindgen")
))]
#[cfg(feature = "now")]
pub use crate::wasm::SystemTime;


pub use std::time::Duration;
3 changes: 0 additions & 3 deletions src/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,9 @@ pub fn now() -> f64 {
return unsafe { js::_emscripten_get_now() };
}

//#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(Copy, Clone, Debug, PartialEq, PartialOrd)]
pub struct SystemTime(f64);

impl Eq for SystemTime {}

impl SystemTime {
pub const UNIX_EPOCH: SystemTime = SystemTime(0.0);

Expand Down
8 changes: 3 additions & 5 deletions tests/wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ fn test_checked_sub() {

#[wasm_bindgen_test]
fn test_system_time() {
assert!(
SystemTime::UNIX_EPOCH
.duration_since(SystemTime::now())
.is_err()
);
assert!(SystemTime::UNIX_EPOCH
.duration_since(SystemTime::now())
.is_err());
}

0 comments on commit 858c708

Please sign in to comment.