build: gate web-time behind cfg(target_arch = "wasm32") (#1086)
This commit is contained in:
@@ -73,6 +73,7 @@ sha2 = { version = "0.10", features = ["oid"], optional = true }
|
||||
rsa = { version = "0.9", optional = true }
|
||||
ed25519-dalek = { version = "2", optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
## web-time for wasm support
|
||||
web-time = { version = "1.1.0", optional = true }
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::time::SystemTime;
|
||||
|
||||
#[cfg(feature = "web")]
|
||||
#[cfg(all(feature = "web", target_arch = "wasm32"))]
|
||||
pub(crate) fn now() -> SystemTime {
|
||||
fn to_std_systemtime(time: web_time::SystemTime) -> std::time::SystemTime {
|
||||
let duration = time
|
||||
@@ -18,7 +18,7 @@ pub(crate) fn now() -> SystemTime {
|
||||
to_std_systemtime(web_time::SystemTime::now())
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "web"))]
|
||||
#[cfg(not(all(feature = "web", target_arch = "wasm32")))]
|
||||
pub(crate) fn now() -> SystemTime {
|
||||
// FIXME: change to #[expect(clippy::disallowed_methods, reason = "the `web` feature is disabled")]
|
||||
#[allow(clippy::disallowed_methods)]
|
||||
|
||||
Reference in New Issue
Block a user