From bbedb622f786ee7d13d860b38b3a8d26b29c14ce Mon Sep 17 00:00:00 2001 From: FuseTim Date: Sun, 11 Jul 2021 15:38:34 +0200 Subject: [PATCH] fix SystemTime::elapsed() On wasm32 target, SystemTime::elapsed() was throwing error due to an inversion in the chronology of Instant. --- src/wasm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wasm.rs b/src/wasm.rs index 57ee1e6..43c487b 100644 --- a/src/wasm.rs +++ b/src/wasm.rs @@ -147,7 +147,7 @@ impl SystemTime { } pub fn elapsed(&self) -> Result { - self.duration_since(SystemTime::now()) + SystemTime::now().duration_since(*self) } pub fn checked_add(&self, duration: Duration) -> Option {