Duration -> LocalDateTime in Twilight
more appropriate for polar seasons
This commit is contained in:
parent
53e1f97b09
commit
bdb3404c3d
1 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue