|
|
|
@ -22,7 +22,6 @@ import lombok.EqualsAndHashCode; |
|
|
|
import lombok.NoArgsConstructor; |
|
|
|
|
|
|
|
import java.time.Duration; |
|
|
|
import java.time.Instant; |
|
|
|
import java.time.ZonedDateTime; |
|
|
|
|
|
|
|
@EqualsAndHashCode(callSuper = true) |
|
|
|
@ -54,12 +53,11 @@ public class CustomInterval extends BaseAggInterval { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected ZonedDateTime getAlignedBoundary(ZonedDateTime reference, boolean next) { |
|
|
|
protected ZonedDateTime alignToIntervalStart(ZonedDateTime reference) { |
|
|
|
ZonedDateTime localMidnight = reference.toLocalDate().atStartOfDay(reference.getZone()); |
|
|
|
long secondsFromMidnight = Duration.between(localMidnight, reference).getSeconds(); |
|
|
|
long alignedSecondsFromMidnight = (secondsFromMidnight / durationSec) * durationSec; |
|
|
|
ZonedDateTime aligned = localMidnight.plusSeconds(alignedSecondsFromMidnight); |
|
|
|
return next ? aligned.plusSeconds(durationSec) : aligned; |
|
|
|
return localMidnight.plusSeconds(alignedSecondsFromMidnight); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
|