On Mon, 10 Nov 2025 08:03:55 GMT, Jaikiran Pai <[email protected]> wrote:

>> test/jdk/java/util/UUID/UUIDTest.java line 154:
>> 
>>> 152:         long timestamp = System.currentTimeMillis();
>>> 153:         try {
>>> 154:             UUID u = UUID.ofEpochMillis(timestamp);
>> 
>> Note that this test will start failing in 20889 [HE].
>> 
>> [HE]: https://en.wikipedia.org/wiki/Holocene_calendar
>
> Hello @ExE-Boss, what would be the failure in that case? I had a very brief 
> look at the linked page and I couldn't relate how that impacts the timestamp 
> based `UUID.ofEpochMillis(...)`.

`UUID::ofEpochMillis` throws `IllegalArgumentException` when the timestamp 
doesn’t fit within 48 bits, and +10889-08-02T05:31:50.656Z[^1] needs 49 bits to 
represent, which is tested on line 183:
https://github.com/openjdk/jdk/blob/27613619899658cdf17c154839606b111e6cf8f0/test/jdk/java/util/UUID/UUIDTest.java#L180-L185

[^1]: At the start of August 20889 [HE].

[HE]: https://en.wikipedia.org/wiki/Holocene_calendar

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25303#discussion_r2541831537

Reply via email to