Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix SystemTime::elapsed() #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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