On Wed, 28 Jun 2023 10:12:18 GMT, Aleksey Shipilev <[email protected]> wrote:
>> Naoto Sato has updated the pull request with a new target base due to a
>> merge or a rebase. The incremental webrev excludes the unrelated changes
>> brought in by the merge/rebase. The pull request contains four additional
>> commits since the last revision:
>>
>> - Merge branch 'master' into JDK-8310232-TickClock-ArithExp
>> - Removed bugid from the test class description
>> - refactor return statement
>> - 8310232: java.time.Clock$TickClock.millis() fails in runtime when tick is
>> 1 microsecond
>
> src/java.base/share/classes/java/time/Clock.java line 762:
>
>> 760: public long millis() {
>> 761: long millis = baseClock.millis();
>> 762: return tickNanos < 1000_000L ? millis : millis -
>> Math.floorMod(millis, tickNanos / 1000_000L);
>
> Cleaner precedence:
>
> Suggestion:
>
> long trunc = (tickNanos >= 1000_000L) ? Math.floorMod(millis,
> tickNanos / 1000_000L) : 0;
> return millis - trunc;
Either is fine, the current version avoids any extra operations if no (further)
truncation is needed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14657#discussion_r1245282851