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

feat(rust): Time Module Implementation #142

Merged
merged 29 commits into from
Mar 13, 2024
Merged

feat(rust): Time Module Implementation #142

merged 29 commits into from
Mar 13, 2024

Conversation

saibatizoku
Copy link
Contributor

@saibatizoku saibatizoku commented Feb 21, 2024

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.

e.g., #123, #456

Please confirm the following checks

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream module

Copy link
Collaborator

@stevenj stevenj left a 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.

Copy link
Collaborator

@stevenj stevenj left a 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.

saibatizoku and others added 6 commits March 12, 2024 11:04
* 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>
stevenj
stevenj previously approved these changes Mar 13, 2024
Copy link
Collaborator

@stevenj stevenj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saibatizoku saibatizoku changed the title [WIP] feat(rust): Time Module Implementation feat(rust): Time Module Implementation Mar 13, 2024
@saibatizoku saibatizoku removed the draft Draft label Mar 13, 2024
@saibatizoku saibatizoku enabled auto-merge (squash) March 13, 2024 18:12
Copy link

@FelipeRosa FelipeRosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@saibatizoku saibatizoku merged commit 9e17eaa into main Mar 13, 2024
15 checks passed
@saibatizoku saibatizoku deleted the feat/time-api-rust branch March 13, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

🛠️ [TASK] : Time utility API: Hermes Implementation (Rust Module)
3 participants