diff --git a/src/main/java/com/ethlo/time/internal/EthloITU.java b/src/main/java/com/ethlo/time/internal/EthloITU.java index 1983ca7..6031162 100644 --- a/src/main/java/com/ethlo/time/internal/EthloITU.java +++ b/src/main/java/com/ethlo/time/internal/EthloITU.java @@ -308,7 +308,6 @@ private static Object handleTime(int year, int month, int day, int hour, int min if (remaining == 2) { final int seconds = parsePositiveInt(chars, 17, 19); - leapSecondCheck(year, month, day, hour, minute, 0, 0, null); if (raw) { return new DateTime(Field.SECOND, year, month, day, hour, minute, seconds, 0, null, 0); @@ -389,10 +388,10 @@ else if (c == PLUS || c == MINUS) } final int second = parsePositiveInt(chars, 17, 19); - leapSecondCheck(year, month, day, hour, minute, second, fractions, offset); if (!raw) { + leapSecondCheck(year, month, day, hour, minute, second, fractions, offset); return OffsetDateTime.of(year, month, day, hour, minute, second, fractions, offset.toZoneOffset()); } return fractionDigits > 0 ? DateTime.of(year, month, day, hour, minute, second, fractions, offset, fractionDigits) : DateTime.of(year, month, day, hour, minute, second, offset); @@ -415,8 +414,8 @@ private static void leapSecondCheck(int year, int month, int day, int hour, int final boolean isValidLeapYearMonth = leapSecondHandler.isValidLeapSecondDate(needle); if (isValidLeapYearMonth || needle.isAfter(leapSecondHandler.getLastKnownLeapSecond())) { - final int utcHour = hour - (offset.getTotalSeconds() / 3_600); - final int utcMinute = minute - ((offset.getTotalSeconds() % 3_600) / 60); + final int utcHour = hour - (offset != null ? (offset.getTotalSeconds() / 3_600) : 0); + final int utcMinute = minute - (offset != null ? ((offset.getTotalSeconds() % 3_600) / 60) : 0); if (((month == Month.DECEMBER.getValue() && day == 31) || (month == Month.JUNE.getValue() && day == 30)) && utcHour == 23 && utcMinute == 59)