Skip to content

Define VM.getNanoTimeAdjustment, so Instant.now() works - #18

Merged
atgreen merged 1 commit into
atgreen:masterfrom
burinc:fix/vm-nano-time-adjustment
Oct 18, 2026
Merged

atgreen merged 1 commit into
atgreen:masterfrom
burinc:fix/vm-nano-time-adjustment

Conversation

@burinc

@burinc burinc commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

VM.getNanoTimeAdjustment, the native behind Clock.currentInstant, is undefined, so Instant.now() signals UNDEFINED-FUNCTION on any platform. Date.toString reaches it too in a time zone with no CLDR display name (GMT+07:00, say), through TimeZone.getDisplayName's GMT-format fallback. That's why aaa/ni.java fails outside UTC.

This defines it as HotSpot does: nanoseconds from the given epoch offset to now, or -1 when the offset is 2^32 seconds or more away. It reads the clock the way System.nanoTime() already does.

Checks: a unit test of the contract (24/24 pass), and the new aaa/instant.java. On macOS arm64 with #16 and #17 as well, make check-regression passes, 501 core passes against a baseline of 492, with aaa/ni.java passing.

The native behind Clock.currentInstant was undefined, so Instant.now()
and anything built on it signalled UNDEFINED-FUNCTION. One path to it is
Date.toString in a time zone CLDR has no display name for (GMT+07:00,
say): TimeZone.getDisplayName falls back to a GMT format through
Instant.now(), which is why aaa/ni.java failed outside UTC.

Answer as HotSpot does: the nanoseconds from the given epoch offset to
now, or -1 when the offset is 2^32 seconds or more away.
burinc added a commit to jlt-commons/jolt-openldk that referenced this pull request Oct 14, 2026
burinc added a commit to jlt-commons/jolt-openldk that referenced this pull request Oct 14, 2026
@atgreen
atgreen merged commit 5bb6ae1 into atgreen:master Oct 18, 2026
atgreen added a commit that referenced this pull request Oct 18, 2026
PRs #16, #17 and #18 each added a testsuite case (aaa/digest, aaa/zlib,
aaa/instant).  check-regression.sh only fails on lost passes and new
failures, so a new test is not actually enforced until it is in the
baseline.  Core suites now 501 expected passes, up from 492; no test
changed state.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@atgreen

atgreen commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Thank you for all of your great PRs!

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