Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[QUICKFIX] Revert "Consistently use UTC for LocalDateTime (#488)" #641

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import app.coronawarn.server.services.distribution.assembly.structure.directory.Directory;
import app.coronawarn.server.services.distribution.config.DistributionServiceConfig;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.temporal.ChronoUnit;
import java.util.Collection;
import org.slf4j.Logger;
Expand Down Expand Up @@ -68,8 +67,7 @@ public class DiagnosisKeysStructureProvider {
public Directory<WritableOnDisk> getDiagnosisKeys() {
logger.debug("Querying diagnosis keys from the database...");
Collection<DiagnosisKey> diagnosisKeys = diagnosisKeyService.getDiagnosisKeys();
diagnosisKeyBundler.setDiagnosisKeys(diagnosisKeys,
LocalDateTime.now(ZoneOffset.UTC).truncatedTo(ChronoUnit.HOURS));
diagnosisKeyBundler.setDiagnosisKeys(diagnosisKeys, LocalDateTime.now().truncatedTo(ChronoUnit.HOURS));
return new DiagnosisKeysDirectory(diagnosisKeyBundler, cryptoProvider, distributionServiceConfig);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private long getGeneratorStartTimestamp(List<DiagnosisKey> diagnosisKeys) {
* this function would return the timestamp for today 14:00 UTC.
*/
private long getGeneratorEndTimestamp() {
return (LocalDateTime.now(ZoneOffset.UTC).toEpochSecond(ZoneOffset.UTC) / ONE_HOUR_INTERVAL_SECONDS) - 1;
return (LocalDateTime.now().toEpochSecond(ZoneOffset.UTC) / ONE_HOUR_INTERVAL_SECONDS) - 1;
}

/**
Expand All @@ -153,7 +153,7 @@ private long getGeneratorEndTimestamp() {
* 14 days ago (from now) at 00:00 UTC.
*/
private long getRetentionStartTimestamp() {
return LocalDate.now(ZoneOffset.UTC).minusDays(retentionDays).atStartOfDay()
return LocalDate.now().minusDays(retentionDays).atStartOfDay()
.toEpochSecond(ZoneOffset.UTC) / ONE_HOUR_INTERVAL_SECONDS;
}

Expand Down