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 panic getting timestamp on wasm32-unknown-unknown target #9

Merged
merged 4 commits into from
Oct 6, 2021

Conversation

dbw9580
Copy link
Contributor

@dbw9580 dbw9580 commented Oct 5, 2021

std::time::SystemTime::now on wasm32-unknown-unknown target is not supported and panics. Related discussion.

This PR fixes this issue by using js_sys::Date::now as a replacement, assuming there's JavaScript environment available at runtime.

tesaguri added a commit to dbw9580/oauth1-request-rs that referenced this pull request Oct 6, 2021
tesaguri added a commit to dbw9580/oauth1-request-rs that referenced this pull request Oct 6, 2021
tesaguri added a commit to dbw9580/oauth1-request-rs that referenced this pull request Oct 6, 2021
tesaguri added a commit to dbw9580/oauth1-request-rs that referenced this pull request Oct 6, 2021
tesaguri added a commit to dbw9580/oauth1-request-rs that referenced this pull request Oct 6, 2021
@tesaguri
Copy link
Owner

tesaguri commented Oct 6, 2021

Thank you for the patch!

I've put this behind a Cargo feature js as we might want to add a different backend in the future.

@tesaguri tesaguri merged commit 2325802 into tesaguri:master Oct 6, 2021
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.

2 participants