diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/PurchasableBadge.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/PurchasableBadge.java index 02819b853..e72bb53d1 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/PurchasableBadge.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/PurchasableBadge.java @@ -10,6 +10,7 @@ import com.fasterxml.jackson.annotation.JsonFormat.Shape; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.Duration; +import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Objects; @@ -27,7 +28,7 @@ public PurchasableBadge( @JsonProperty("svgs") final List svgs, @JsonProperty("duration") final Duration duration) { super(id, category, name, description, sprites6, svg, svgs); - this.duration = duration; + this.duration = duration != null ? duration.truncatedTo(ChronoUnit.SECONDS) : null; } public PurchasableBadge(final Badge badge, final Duration duration) { @@ -39,7 +40,7 @@ public PurchasableBadge(final Badge badge, final Duration duration) { badge.getSprites6(), badge.getSvg(), badge.getSvgs()); - this.duration = duration; + this.duration = duration != null ? duration.truncatedTo(ChronoUnit.SECONDS) : null; } @JsonFormat(shape = Shape.NUMBER_INT) diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java index 18a90d57d..de10314f1 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java @@ -9,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.List; public class UserRemoteConfigList { @@ -24,7 +25,7 @@ public UserRemoteConfigList() {} public UserRemoteConfigList(List config, Instant serverEpochTime) { this.config = config; - this.serverEpochTime = serverEpochTime; + this.serverEpochTime = serverEpochTime != null ? serverEpochTime.truncatedTo(ChronoUnit.SECONDS) : null; } public List getConfig() {