summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Tan <jonathantanmy@google.com>2020-10-19 12:25:57 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2020-10-19 12:25:57 -0400
commitde914b7caf763b74161552285fed409fe552df64 (patch)
tree8c6dbfec5ec12185e63fcccfdb96b8c6c6b2ae1f
parent88e924e86beaa7e4911f4496e847a10833ac1c15 (diff)
parenta0d3680f494caa6275695fbd3397fd9b5805964d (diff)
downloadjgit-de914b7caf763b74161552285fed409fe552df64.tar.gz
jgit-de914b7caf763b74161552285fed409fe552df64.zip
Merge "Compute time differences with Duration"
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
index 26c7ab7531..1242ef1b4a 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java
@@ -42,6 +42,8 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.text.MessageFormat;
+import java.time.Duration;
+import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -1008,7 +1010,7 @@ public class UploadPack {
else
advertised = refIdSet(getAdvertisedOrDefaultRefs().values());
- long negotiateStart = System.currentTimeMillis();
+ Instant negotiateStart = Instant.now();
accumulator.advertised = advertised.size();
ProtocolV0Parser parser = new ProtocolV0Parser(transferConfig);
@@ -1050,8 +1052,8 @@ public class UploadPack {
if (!req.getClientShallowCommits().isEmpty())
walk.assumeShallow(req.getClientShallowCommits());
sendPack = negotiate(req, accumulator, pckOut);
- accumulator.timeNegotiating += System.currentTimeMillis()
- - negotiateStart;
+ accumulator.timeNegotiating = Duration
+ .between(negotiateStart, Instant.now()).toMillis();
if (sendPack && !biDirectionalPipe) {
// Ensure the request was fully consumed. Any remaining input must
@@ -1138,7 +1140,7 @@ public class UploadPack {
}
PackStatistics.Accumulator accumulator = new PackStatistics.Accumulator();
- long negotiateStart = System.currentTimeMillis();
+ Instant negotiateStart = Instant.now();
ProtocolV2Parser parser = new ProtocolV2Parser(transferConfig);
FetchV2Request req = parser.parseFetchRequest(pckIn);
@@ -1244,8 +1246,8 @@ public class UploadPack {
pckOut.writeString("packfile\n"); //$NON-NLS-1$
}
- accumulator.timeNegotiating = System.currentTimeMillis()
- - negotiateStart;
+ accumulator.timeNegotiating = Duration
+ .between(negotiateStart, Instant.now()).toMillis();
sendPack(accumulator,
req,
@@ -1795,12 +1797,13 @@ public class UploadPack {
if (notAdvertisedWants != null) {
accumulator.notAdvertisedWants = notAdvertisedWants.size();
- long startReachabilityChecking = System.currentTimeMillis();
+ Instant startReachabilityChecking = Instant.now();
requestValidator.checkWants(this, notAdvertisedWants);
- accumulator.reachabilityCheckDuration = System.currentTimeMillis() -
- startReachabilityChecking;
+ accumulator.reachabilityCheckDuration = Duration
+ .between(startReachabilityChecking, Instant.now())
+ .toMillis();
}
AsyncRevObjectQueue q = walk.parseAny(wantIds, true);