Skip to content

Conversation

fusetim
Copy link

@fusetim fusetim commented Jul 11, 2021

On wasm32 target, SystemTime::elapsed() was throwing error due to an inversion in the chronology of Instant.
duration_since need an earlier Instant in argument to work properly, and self should be before now (because we want elapsed time).
So the fix is:

    pub fn elapsed(&self) -> Result<Duration, ()> {
        SystemTime::now().duration_since(*self)
    }

On wasm32 target, SystemTime::elapsed() was throwing error due to an inversion in the chronology of Instant.
whizsid added a commit to whizsid/wasmtimer-rs that referenced this pull request Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant