From 98a747792267872034e3f79c4cb4632415febd05 Mon Sep 17 00:00:00 2001 From: Craigory Coppola Date: Tue, 15 Aug 2023 16:54:44 -0500 Subject: [PATCH] fix(core): use Date.now() everywhere for tasks start and end times to avoid negative durations (#18595) --- .../src/tasks-runner/life-cycles/task-profiling-life-cycle.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/tasks-runner/life-cycles/task-profiling-life-cycle.ts b/packages/nx/src/tasks-runner/life-cycles/task-profiling-life-cycle.ts index c851cfca6c7f5..2f777a97d48da 100644 --- a/packages/nx/src/tasks-runner/life-cycles/task-profiling-life-cycle.ts +++ b/packages/nx/src/tasks-runner/life-cycles/task-profiling-life-cycle.ts @@ -27,7 +27,7 @@ export class TaskProfilingLifeCycle implements LifeCycle { } for (let t of tasks) { this.timings[t.id] = { - perfStart: performance.now(), + perfStart: Date.now(), }; } } @@ -43,7 +43,7 @@ export class TaskProfilingLifeCycle implements LifeCycle { if (tr.task.endTime) { this.timings[tr.task.id].perfEnd = tr.task.endTime; } else { - this.timings[tr.task.id].perfEnd = performance.now(); + this.timings[tr.task.id].perfEnd = Date.now(); } } this.recordTaskCompletions(taskResults, metadata);