From e350acae8d713df28dad5a16e6df843e1b738027 Mon Sep 17 00:00:00 2001 From: Jan Sievers Date: Tue, 9 Jun 2020 22:39:21 +0200 Subject: [PATCH] Revert "Consistently use UTC for LocalDateTime (#488)" This reverts commit ec099f3510165f65cbfd6c6d2e6a5fcd6cbdcb2e. --- .../assembly/component/DiagnosisKeysStructureProvider.java | 4 +--- .../services/distribution/runner/TestDataGeneration.java | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/services/distribution/src/main/java/app/coronawarn/server/services/distribution/assembly/component/DiagnosisKeysStructureProvider.java b/services/distribution/src/main/java/app/coronawarn/server/services/distribution/assembly/component/DiagnosisKeysStructureProvider.java index 4276c898b1..e1f437692c 100644 --- a/services/distribution/src/main/java/app/coronawarn/server/services/distribution/assembly/component/DiagnosisKeysStructureProvider.java +++ b/services/distribution/src/main/java/app/coronawarn/server/services/distribution/assembly/component/DiagnosisKeysStructureProvider.java @@ -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; @@ -68,8 +67,7 @@ public class DiagnosisKeysStructureProvider { public Directory getDiagnosisKeys() { logger.debug("Querying diagnosis keys from the database..."); Collection 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); } } diff --git a/services/distribution/src/main/java/app/coronawarn/server/services/distribution/runner/TestDataGeneration.java b/services/distribution/src/main/java/app/coronawarn/server/services/distribution/runner/TestDataGeneration.java index 5775399286..1c1f0a6b58 100644 --- a/services/distribution/src/main/java/app/coronawarn/server/services/distribution/runner/TestDataGeneration.java +++ b/services/distribution/src/main/java/app/coronawarn/server/services/distribution/runner/TestDataGeneration.java @@ -144,7 +144,7 @@ private long getGeneratorStartTimestamp(List 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; } /** @@ -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; }