Skip to content

Commit

Permalink
Use Instant for Unix epoch seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Feb 28, 2023
1 parent ff658f2 commit 283ac42
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import java.io.Closeable;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.Instant;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
Expand Down Expand Up @@ -435,11 +434,11 @@ public void close() {
}

private long ttlEpochSeconds() {
return LocalDateTime.now().plus(this.leaseDuration).toEpochSecond(ZoneOffset.UTC);
return Instant.now().plus(this.leaseDuration).getEpochSecond();
}

private static long currentEpochSeconds() {
return LocalDateTime.now().toEpochSecond(ZoneOffset.UTC);
return Instant.now().getEpochSecond();
}

}

0 comments on commit 283ac42

Please sign in to comment.