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:
@@ -17,6 +17,8 @@ package com.google.gerrit.launcher;
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static java.util.concurrent.TimeUnit.MILLISECONDS;
|
||||
|
||||
import org.joda.time.DateTimeUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -506,7 +508,7 @@ public final class GerritLauncher {
|
||||
//
|
||||
final File[] tmpEntries = tmp.listFiles();
|
||||
if (tmpEntries != null) {
|
||||
final long now = System.currentTimeMillis();
|
||||
final long now = DateTimeUtils.currentTimeMillis();
|
||||
final long expired = now - MILLISECONDS.convert(7, DAYS);
|
||||
for (final File tmpEntry : tmpEntries) {
|
||||
if (tmpEntry.isDirectory() && tmpEntry.lastModified() < expired) {
|
||||
|
Reference in New Issue
Block a user