Skip to content

Commit

Permalink
Simplify days since epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas committed Jan 25, 2024
1 parent 7ea9f3d commit 85be183
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
public final class IcebergEncoder implements BucketMetadata.Encoder {

private static final OffsetDateTime EPOCH = Instant.ofEpochSecond(0).atOffset(ZoneOffset.UTC);
private static final LocalDate EPOCH_DAY = EPOCH.toLocalDate();

private byte[] encode(int value) {
return encode((long) value);
Expand All @@ -58,7 +57,7 @@ private byte[] encode(UUID value) {
}

private byte[] encode(LocalDate value) {
return encode(ChronoUnit.DAYS.between(EPOCH_DAY, value));
return encode(value.toEpochDay());
}

private byte[] encode(LocalTime value) {
Expand Down

0 comments on commit 85be183

Please sign in to comment.