diff --git a/src/main/java/eu/m724/wtapi/object/Twilight.java b/src/main/java/eu/m724/wtapi/object/Twilight.java index 5ea3754..97052c4 100644 --- a/src/main/java/eu/m724/wtapi/object/Twilight.java +++ b/src/main/java/eu/m724/wtapi/object/Twilight.java @@ -8,9 +8,20 @@ import java.time.LocalDateTime; * @param date The date this object contains times for * @param sunrise Time of sunrise * @param sunset Time of sunset + * @param solarNoon Time of solar noon in the current day.
+ * If polar night, the solar noon still applies, because the sun still exists, but doesn't rise above the horizon. + * @param polar Is polar cycle */ -public record Twilight(LocalDate date, LocalDateTime sunrise, LocalDateTime sunset) { +public record Twilight(LocalDate date, LocalDateTime sunrise, LocalDateTime sunset, LocalDateTime solarNoon, boolean polar) { public Duration getDayLength() { return Duration.between(sunrise, sunset); } + + public boolean isPolarNight() { + return polar && Duration.between(sunrise, sunset).isNegative(); + } + + public boolean isPolarDay() { + return polar && !isPolarNight(); + } }