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

Add nanosecond-precision clock #6

Closed
erikc5000 opened this issue Oct 28, 2019 · 0 comments · Fixed by #118
Closed

Add nanosecond-precision clock #6

erikc5000 opened this issue Oct 28, 2019 · 0 comments · Fixed by #118
Assignees
Labels
design Design issue/question enhancement New feature or request
Milestone

Comments

@erikc5000
Copy link
Owner

The current clock implementation is limited to millisecond precision, which is the best you can get with Android or Java 8 anyway. But on Java 9 and iOS/macOS, microsecond resolution is available.

Millisecond resolution may be fine for most and should be a bit faster -- certainly, it'll result in fewer allocations when getting the current time. The default should probably be nanosecond precision where available, but providing the option to use a faster millisecond precision clock would be the best of both worlds.

To support nanosecond precision time on Java 9, we'd want to introduce a PlatformInstant expect class that is implemented by Java's Instant class and wrap Java's Clock. This should keep additional allocations to a minimum. Since we'd be using java.time classes under the hood, this implementation won't work on Android though, so it'll require a new target or project rearrangement of some sort.

@erikc5000 erikc5000 added design Design issue/question enhancement New feature or request labels Oct 28, 2019
@erikc5000 erikc5000 added this to the 0.3.0 milestone Jul 30, 2020
@erikc5000 erikc5000 self-assigned this Jul 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design Design issue/question enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant