]> source.dussan.org Git - jgit.git/commit
Compute time differences with Duration 62/170562/3
authorAlexa Panfil <alexapizza@google.com>
Fri, 9 Oct 2020 16:52:04 +0000 (16:52 +0000)
committerAlexa Panfil <alexapizza@google.com>
Fri, 9 Oct 2020 18:55:20 +0000 (18:55 +0000)
commita0d3680f494caa6275695fbd3397fd9b5805964d
treece8382262e98c01552f4ed6010d8f58a29f16c89
parentb0b32501978c00018c3a046a09e474a1d783275a
Compute time differences with Duration

Reason why this change is needed:
Currently the durations of fetch events are computed by
registering time instants with System.currentTimeMillis()
and calculating the differences with simple minus operation,
but multiple sources suggest that the best practice is to use
the Java 8 Duration and Instant objects.

What this patch does:
Get time measurements with Instant.now() instead of
System.currentTimeMillis() and calculate the duration of fetch
events (Reachability checks and Negotiation) using
Duration.between().toMillis().

Signed-off-by: Alexa Panfil <alexapizza@google.com>
Change-Id: I573a0a0562070083cf5a5a196d9710f69a7fa587
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java