diff --git a/server/src/main/java/org/opensearch/common/time/EpochTime.java b/server/src/main/java/org/opensearch/common/time/EpochTime.java index 4812dea61e31c..9f417acfcdb17 100644 --- a/server/src/main/java/org/opensearch/common/time/EpochTime.java +++ b/server/src/main/java/org/opensearch/common/time/EpochTime.java @@ -126,10 +126,12 @@ public boolean isSupportedBy(TemporalAccessor temporal) { public long getFrom(TemporalAccessor temporal) { long instantSecondsInMillis = temporal.getLong(ChronoField.INSTANT_SECONDS) * 1_000; if (instantSecondsInMillis >= 0) { - if (temporal.isSupported(ChronoField.NANO_OF_SECOND)) return instantSecondsInMillis + (temporal.getLong( - ChronoField.NANO_OF_SECOND - ) / 1_000_000); - else return instantSecondsInMillis + temporal.getLong(ChronoField.MILLI_OF_SECOND); + if (temporal.isSupported(ChronoField.NANO_OF_SECOND)) { + return instantSecondsInMillis + (temporal.getLong(ChronoField.NANO_OF_SECOND) / 1_000_000); + } + else { + return instantSecondsInMillis + temporal.getLong(ChronoField.MILLI_OF_SECOND); + } } else { // negative timestamp if (temporal.isSupported(ChronoField.NANO_OF_SECOND)) { long millis = instantSecondsInMillis;