-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat(rust): Time Module Implementation #142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also needs the wasi/clock APIs as these are part of the Time utilities for Hermes.
19dff86
to
7ef7801
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wall clock can just be implemented using:
https://doc.rust-lang.org/std/time/struct.SystemTime.html
Use the constant UNIX_EPOCH
as the base for wall clock.
Then get elapsed().as_nanos()
which will return a u128 which can be mapped into the sec/nanosec of the wasm return type.
Again, resolution here would always be nanosceonds.
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/host.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/host.rs
Outdated
Show resolved
Hide resolved
c107fb2
to
184d96f
Compare
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/state.rs
Outdated
Show resolved
Hide resolved
hermes/bin/src/runtime_extensions/wasi/clocks/monotonic/host.rs
Outdated
Show resolved
Hide resolved
* stores resolution at initialization * exposes resolution through pub(crate) function
All monotonic requires is that it never go backwards, but it can remain the same in subsequent calls. Co-authored-by: Steven Johnson <stevenj@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Thanks for contributing to the project!
Please fill out this template to help us review your changes.
Related Issue(s)
List the issue numbers related to this pull request.
Closes #88
Description of Changes
Provide a clear and concise description of what the pull request changes.
Breaking Changes
Describe any breaking changes and the impact.
Screenshots
If applicable, add screenshots to help explain your changes.
Related Pull Requests
If applicable, list any related pull requests.
Please confirm the following checks