Hi, Please find below a patch for:
8074032: Instant.ofEpochMilli(millis).toEpochMilli() can throw arithmetic overflow in toEpochMilli() http://cr.openjdk.java.net/~dfuchs/webrev_8074032/webrev.00/ The issue is that when converting milliseconds to seconds + nanos Instant.ofEpochMilli() uses floorDiv and floorMod, as it should. This means that for negative values of 'millis' then seconds will be millis/1000 - 1, and nanos will be positive. When converting back to epoch millis, if multiplyExact is used without precaution, then (millis/1000 -1) * 1000 may not fit in a long. The solution is thus to compute ((millis/1000 -1) +1) * 1000 instead and then add (nanos - 1000) to the result. Note: this issue is causing some JCK tests that call LogRecord.setMillis(Long.MIN_VALUE) to fail. best regards, -- daniel