Skip to content

Commit

Permalink
Correct timestamp resolution to intended integer value
Browse files Browse the repository at this point in the history
  • Loading branch information
ehrenkret-signal committed Jun 29, 2023
1 parent fb39b2e commit 859f646
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -27,7 +28,7 @@ public PurchasableBadge(
@JsonProperty("svgs") final List<BadgeSvg> 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) {
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,7 +25,7 @@ public UserRemoteConfigList() {}

public UserRemoteConfigList(List<UserRemoteConfig> config, Instant serverEpochTime) {
this.config = config;
this.serverEpochTime = serverEpochTime;
this.serverEpochTime = serverEpochTime != null ? serverEpochTime.truncatedTo(ChronoUnit.SECONDS) : null;
}

public List<UserRemoteConfig> getConfig() {
Expand Down

0 comments on commit 859f646

Please sign in to comment.