Duration -> LocalDateTime in Twilight

more appropriate for polar seasons
This commit is contained in:
Minecon724 2024-09-26 17:59:45 +02:00
parent 53e1f97b09
commit bdb3404c3d
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -2,14 +2,15 @@ package eu.m724.wtapi.object;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
/** /**
* @param date The date this object contains times for * @param date The date this object contains times for
* @param sunrise Time of sunrise relative to UTC midnight of the date * @param sunrise Time of sunrise
* @param sunset Time of sunset relative to UTC midnight of the date * @param sunset Time of sunset
*/ */
public record Twilight(LocalDate date, Duration sunrise, Duration sunset) { public record Twilight(LocalDate date, LocalDateTime sunrise, LocalDateTime sunset) {
public Duration getDayLength() { public Duration getDayLength() {
return sunset.minus(sunrise); return Duration.between(sunrise, sunset);
} }
} }