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: get timestamp #86 #97

Closed
wants to merge 3 commits into from
Closed

Conversation

smallbearrr
Copy link

No description provided.

Copy link

peter-jerry-ye-code-review bot commented Jan 22, 2025

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Looking at the git diff, here are potential issues I've noticed:

  1. In the now() function, current_second calculation only returns seconds within a minute (0-59) due to % 60. This might be unintended as typically timestamp functions return total seconds since epoch, not just the seconds within the current minute.

  2. In the nanosecond calculation (t % 1000 * 1_000_000).to_uint(), there might be precision loss since the calculation assumes t is in milliseconds and converts to nanoseconds. If higher precision is needed, this conversion might not be accurate enough.

  3. There's an inconsistency in the type signatures between the implementation (.mbt) and interface (.mbti) files. The implementation specifies UInt64 and UInt return types explicitly, but this level of specificity isn't reflected in the interface file which just shows fn now() -> (UInt64, UInt). It would be good to add documentation in the interface file to match the implementation file's comments.

These observations might or might not be actual problems depending on the specific requirements of your system, but they're worth reviewing.

@peter-jerry-ye
Copy link
Collaborator

I think it would be better to keep time library containing purely the algorithm, and leave the system related API in env.

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