Fix wall-time of the SpawnResult in WorkerSpawnRunner
Previously we would do `currentTime - startTime`, but `Duration.between`
expects the first parameter to be the start-time and will return
negative `Duration` otherwise.
RELNOTES: Fix wall-time of the SpawnResult in WorkerSpawnRunner
PiperOrigin-RevId: 303120753
diff --git a/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java b/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
index 6eaebb8..ea2b558 100644
--- a/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
+++ b/src/main/java/com/google/devtools/build/lib/worker/WorkerSpawnRunner.java
@@ -195,7 +195,7 @@
Instant startTime = Instant.now();
WorkResponse response =
execInWorker(spawn, key, context, inputFiles, outputs, flagFiles, inputFileCache);
- Duration wallTime = Duration.between(Instant.now(), startTime);
+ Duration wallTime = Duration.between(startTime, Instant.now());
FileOutErr outErr = context.getFileOutErr();
response.getOutputBytes().writeTo(outErr.getErrorStream());