Adapt to TimeUtil changes in Gerrit core

Change I5d5bf51a5 dropped TimeUtil#never() and
TimeUtil#truncateToSecond(Timestamp) was removed by change Ie1a5d4871.

Adapt the checks plugin so that it builds again.

Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I016022751fadfbc03a43996ad82cdd0248e8635b
diff --git a/java/com/google/gerrit/plugins/checks/CheckUpdate.java b/java/com/google/gerrit/plugins/checks/CheckUpdate.java
index 0b86796..adbfff0 100644
--- a/java/com/google/gerrit/plugins/checks/CheckUpdate.java
+++ b/java/com/google/gerrit/plugins/checks/CheckUpdate.java
@@ -16,8 +16,8 @@
 
 import com.google.auto.value.AutoValue;
 import com.google.gerrit.plugins.checks.api.CheckState;
-import com.google.gerrit.server.util.time.TimeUtil;
 import java.sql.Timestamp;
+import java.time.Instant;
 import java.util.Optional;
 
 @AutoValue
@@ -51,11 +51,11 @@
     public abstract Builder setFinished(Timestamp finished);
 
     public Builder unsetStarted() {
-      return setStarted(TimeUtil.never());
+      return setStarted(Timestamp.from(Instant.EPOCH));
     }
 
     public Builder unsetFinished() {
-      return setFinished(TimeUtil.never());
+      return setFinished(Timestamp.from(Instant.EPOCH));
     }
 
     public abstract CheckUpdate build();
diff --git a/java/com/google/gerrit/plugins/checks/db/CheckerConfig.java b/java/com/google/gerrit/plugins/checks/db/CheckerConfig.java
index f248da8..9fbfffd 100644
--- a/java/com/google/gerrit/plugins/checks/db/CheckerConfig.java
+++ b/java/com/google/gerrit/plugins/checks/db/CheckerConfig.java
@@ -279,7 +279,7 @@
     // Commit timestamps are internally truncated to seconds. To return the correct 'created' time
     // for new checkers, we explicitly need to truncate the timestamp here.
     Timestamp commitTimestamp =
-        TimeUtil.truncateToSecond(new Timestamp(commit.getCommitter().getWhen().getTime()));
+        Timestamp.from(TimeUtil.truncateToSecond(commit.getCommitter().getWhen().toInstant()));
     commit.setAuthor(new PersonIdent(commit.getAuthor(), commitTimestamp));
     commit.setCommitter(new PersonIdent(commit.getCommitter(), commitTimestamp));
 
diff --git a/java/com/google/gerrit/plugins/checks/db/NoteDbCheck.java b/java/com/google/gerrit/plugins/checks/db/NoteDbCheck.java
index 978b569..9945e11 100644
--- a/java/com/google/gerrit/plugins/checks/db/NoteDbCheck.java
+++ b/java/com/google/gerrit/plugins/checks/db/NoteDbCheck.java
@@ -9,8 +9,8 @@
 import com.google.gerrit.plugins.checks.CheckUpdate;
 import com.google.gerrit.plugins.checks.CheckerUuid;
 import com.google.gerrit.plugins.checks.api.CheckState;
-import com.google.gerrit.server.util.time.TimeUtil;
 import java.sql.Timestamp;
+import java.time.Instant;
 
 /** Representation of {@link Check} that can be serialized with GSON. */
 class NoteDbCheck {
@@ -75,7 +75,7 @@
       modified = true;
     }
     if (update.started().isPresent() && !update.started().get().equals(started)) {
-      if (update.started().get().equals(TimeUtil.never())) {
+      if (update.started().get().toInstant().equals(Instant.EPOCH)) {
         started = null;
       } else {
         started = update.started().get();
@@ -83,7 +83,7 @@
       modified = true;
     }
     if (update.finished().isPresent() && !update.finished().get().equals(finished)) {
-      if (update.finished().get().equals(TimeUtil.never())) {
+      if (update.finished().get().toInstant().equals(Instant.EPOCH)) {
         finished = null;
       } else {
         finished = update.finished().get();