Use web-time to return a SystemTime that works under WASM
The `MilliSecondsSinceUnixEpoch::to_system_time()` method returns the `SystemTime` type from the standard library. The `std::time::SystemTime::elapsed()` method sadly panics under WASM. Instead of returning the `SystemTime` from the standard library we're now returning a drop-in replacement of this type coming from the web-time crate.
This commit is contained in:
parent
6c4d1c0fd7
commit
ccd3b81557
@ -14,6 +14,9 @@ Breaking changes:
|
|||||||
|
|
||||||
Improvements:
|
Improvements:
|
||||||
|
|
||||||
|
- Use the [web-time](https://github.com/daxpedda/web-time) crate to return a
|
||||||
|
`SystemTime` that works under WASM in the
|
||||||
|
`MilliSecondsSinceUnixEpoch::to_system_time()` method.
|
||||||
- Stabilize support for `.m.rule.suppress_edits` push rule (MSC3958 / Matrix 1.9)
|
- Stabilize support for `.m.rule.suppress_edits` push rule (MSC3958 / Matrix 1.9)
|
||||||
- Add `MatrixVersion::V1_9`
|
- Add `MatrixVersion::V1_9`
|
||||||
- Point links to the Matrix 1.9 specification
|
- Point links to the Matrix 1.9 specification
|
||||||
|
@ -77,6 +77,7 @@ time = "0.3.34"
|
|||||||
tracing = { workspace = true, features = ["attributes"] }
|
tracing = { workspace = true, features = ["attributes"] }
|
||||||
url = "2.2.2"
|
url = "2.2.2"
|
||||||
uuid = { version = "1.0.0", optional = true, features = ["v4"] }
|
uuid = { version = "1.0.0", optional = true, features = ["v4"] }
|
||||||
|
web-time = "1.1.0"
|
||||||
wildmatch = "2.0.0"
|
wildmatch = "2.0.0"
|
||||||
|
|
||||||
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fmt,
|
fmt,
|
||||||
time::{Duration, SystemTime, UNIX_EPOCH},
|
time::{Duration, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
|
|
||||||
use js_int::{uint, UInt};
|
use js_int::{uint, UInt};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
|
use web_time::SystemTime;
|
||||||
|
|
||||||
/// A timestamp represented as the number of milliseconds since the unix epoch.
|
/// A timestamp represented as the number of milliseconds since the unix epoch.
|
||||||
#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)]
|
#[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord, Deserialize, Serialize)]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user