Skip to content

Commit ffa68e2

Browse files
Update clients/src/main/java/org/apache/kafka/common/utils/Utils.java
Co-authored-by: refacto-visz[bot] <230139763+refacto-visz[bot]@users.noreply.github.com>
1 parent 54a1104 commit ffa68e2

File tree

1 file changed

+4
-1
lines changed
  • clients/src/main/java/org/apache/kafka/common/utils

1 file changed

+4
-1
lines changed

clients/src/main/java/org/apache/kafka/common/utils/Utils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,12 @@ public interface ThrowingRunnable {
17031703
* @param timeMs the time in millisecond
17041704
* @return the converted nanosecond
17051705
*/
1706+
private static final long NANOS_PER_MILLISECOND = 1_000_000L;
1707+
17061708
public static long msToNs(long timeMs) {
17071709
try {
1708-
return Math.multiplyExact(1000 * 1000, timeMs);
1710+
return Math.multiplyExact(NANOS_PER_MILLISECOND, timeMs);
1711+
} catch (ArithmeticException e) {
17091712
} catch (ArithmeticException e) {
17101713
throw new IllegalArgumentException("Cannot convert " + timeMs + " millisecond to nanosecond due to arithmetic overflow", e);
17111714
}

0 commit comments

Comments
 (0)