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

System.currentTimeMillis() #2

Open
cgay opened this issue Sep 10, 2024 · 2 comments
Open

System.currentTimeMillis() #2

cgay opened this issue Sep 10, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@cgay
Copy link
Owner

cgay commented Sep 10, 2024

Should have some equivalent to System.currentTimeMillis(). In other words, "get me an integer that represents 'now' which I can stash away and compare to later." Wanted this for Dylox's clock() implementation.

@cgay cgay added the enhancement New feature or request label Sep 10, 2024
@cgay
Copy link
Owner Author

cgay commented Sep 12, 2024

In time@0.1.1 I pushed some changes I'd made a while back to get basic macOS support working. I simply used CLOCK_MONOTONIC instead of the _RAW version, however I think the right fix is to use CLOCK_UPTIME_RAW based on this post: https://reviews.llvm.org/D27429

While I'm here... Java now has System.nanoTime() as well, and we might want something like that in addition to (or instead of) something like System.currentTimeMillis().

@cgay
Copy link
Owner Author

cgay commented Sep 14, 2024

There's a nice write-up of the issues here: ros2/rcutils#43 (comment)

And more useful discussion here: https://groups.google.com/g/golang-nuts/c/YYi57cFhnL4

And this Python PEP is referenced by the above golang thread: https://peps.python.org/pep-0418/#monotonic-clocks (lots of useful reading here)

The summary seems to be "this is hard"....

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
None yet
Development

No branches or pull requests

1 participant