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:
		| @@ -26,6 +26,7 @@ import com.google.gerrit.server.cache.h2.H2CacheImpl; | ||||
| import com.google.gerrit.server.config.SitePath; | ||||
| import com.google.gerrit.server.git.WorkQueue; | ||||
| import com.google.gerrit.server.git.WorkQueue.Task; | ||||
| import com.google.gerrit.server.util.TimeUtil; | ||||
| import com.google.gerrit.sshd.CommandMetaData; | ||||
| import com.google.gerrit.sshd.SshDaemon; | ||||
| import com.google.inject.Inject; | ||||
| @@ -59,7 +60,7 @@ final class ShowCaches extends CacheCommand { | ||||
|   static class StartupListener implements LifecycleListener { | ||||
|     @Override | ||||
|     public void start() { | ||||
|       serverStarted = System.currentTimeMillis(); | ||||
|       serverStarted = TimeUtil.nowMs(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
| @@ -270,7 +271,7 @@ final class ShowCaches extends CacheCommand { | ||||
|       return; | ||||
|     } | ||||
|  | ||||
|     long now = System.currentTimeMillis(); | ||||
|     long now = TimeUtil.nowMs(); | ||||
|     Collection<IoSession> list = acceptor.getManagedSessions().values(); | ||||
|     long oldest = now; | ||||
|     for (IoSession s : list) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dave Borowitz
					Dave Borowitz