From defd9d39a7e391ea24ca1f3f8f7e2274afd976dd Mon Sep 17 00:00:00 2001 From: Myriad-Dreamin Date: Sun, 29 Dec 2024 11:05:14 +0800 Subject: [PATCH] fix: absurd web_time --- crates/reflexo/src/time.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/reflexo/src/time.rs b/crates/reflexo/src/time.rs index 9523457d..48976511 100644 --- a/crates/reflexo/src/time.rs +++ b/crates/reflexo/src/time.rs @@ -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.