chore(deps): replace instant with web-time (#1830)

* chore(deps): replace `instant` with `web-time`

Close https://github.com/paritytech/subxt/issues/1597

* fix build

* fix build v2

* cargo fmt
This commit is contained in:
Niklas Adolfsson
2024-10-22 15:54:54 +02:00
committed by GitHub
parent c07c760d85
commit 418bd88e62
6 changed files with 21 additions and 24 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ web = [
# For the light-client platform.
"wasm-bindgen-futures",
"futures-timer/wasm-bindgen",
"instant/wasm-bindgen",
"web-time",
"pin-project",
# For websocket.
@@ -66,7 +66,7 @@ wasm-bindgen-futures = { workspace = true, optional = true }
smoldot = { workspace = true, optional = true }
pin-project = { workspace = true, optional = true }
futures-timer = { workspace = true, optional = true }
instant = { workspace = true, optional = true }
web-time = { workspace = true, optional = true }
getrandom = { workspace = true, optional = true }
[package.metadata.docs.rs]
+4 -4
View File
@@ -11,17 +11,17 @@ use core::time::Duration;
use futures_util::{future, FutureExt};
pub fn now_from_unix_epoch() -> Duration {
instant::SystemTime::now()
.duration_since(instant::SystemTime::UNIX_EPOCH)
web_time::SystemTime::now()
.duration_since(web_time::SystemTime::UNIX_EPOCH)
.unwrap_or_else(|_| {
panic!("Invalid systime cannot be configured earlier than `UNIX_EPOCH`")
})
}
pub type Instant = instant::Instant;
pub type Instant = web_time::Instant;
pub fn now() -> Instant {
instant::Instant::now()
web_time::Instant::now()
}
pub type Delay = future::BoxFuture<'static, ()>;