Skip to content

Commit

Permalink
fix: absurd web_time
Browse files Browse the repository at this point in the history
  • Loading branch information
Myriad-Dreamin committed Dec 29, 2024
1 parent 408e1d7 commit defd9d3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions crates/reflexo/src/time.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
pub use std::time::SystemTime as Time;
pub use web_time::Duration;
pub use web_time::Instant;
pub use web_time::SystemTime as Time;

/// Returns the current time (UTC+0).
#[cfg(any(feature = "system", feature = "web"))]
pub fn now() -> Time {
Time::now()
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
{
Time::now()
}
#[cfg(all(target_family = "wasm", target_os = "unknown"))]
{
use web_time::SystemTimeExt;
web_time::SystemTime::now().to_std()
}
}

/// Returns a dummy time on environments that do not support time.
Expand Down

0 comments on commit defd9d3

Please sign in to comment.