On Tue, 7 Sep 2021 18:18:49 GMT, Naoto Sato <na...@openjdk.org> wrote:

> Please review the fix to the issue. Avoiding overflow by not calling 
> nanosUntil() directly, which will overflow beyond Long.MAX_VALUE difference 
> in nano unit.

Marked as reviewed by rriggs (Reviewer).

src/java.base/share/classes/java/time/Instant.java line 1170:

> 1168:         long secsDiff = Math.subtractExact(end.seconds, seconds);
> 1169:         long totalMicros = Math.multiplyExact(secsDiff, 
> NANOS_PER_SECOND / 1000);
> 1170:         return Math.addExact(totalMicros, (end.nanos - nanos) / 1000);

Can you define NANOS_PER_MICRO, the others conversions use predefined constants.

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

PR: https://git.openjdk.java.net/jdk/pull/5396

Reply via email to