Use DateTimeUtils.currentTimeMillis() to get current time

This method from joda-time supports replacing the system time provider
with a custom provider for tests. Since it is verbose, and we expect
more related methods, put it in the more succinct TimeUtil.nowMs().

This commit covers the trivial cases in the server side; client-side
code still uses System.currentTimeMillis().

Change-Id: I6c56e8c5bbb0cf7b0271e431d1ebdb532967b9e8
This commit is contained in:
Dave Borowitz
2013-10-15 14:27:34 -07:00
parent 925bcc15e0
commit 46b1ac8f07
37 changed files with 152 additions and 64 deletions

View File

@@ -18,6 +18,7 @@ import com.google.gerrit.common.Version;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.util.TimeUtil;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
@@ -222,7 +223,7 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
/** Takes compiled prolog .class files, puts them into the jar file. */
private void createJar(File archiveFile, List<String> toBeJared,
File tempDir, ObjectId metaConfig, ObjectId rulesId) throws IOException {
long now = System.currentTimeMillis();
long now = TimeUtil.nowMs();
File tmpjar = File.createTempFile(".rulec_", ".jar", archiveFile.getParentFile());
try {
Manifest mf = new Manifest();
@@ -315,4 +316,4 @@ public class PrologCompiler implements Callable<PrologCompiler.Status> {
}
dir.delete();
}
}
}