From d1e2e5e62a7f46178cc5dc2e60dd9d8339f89aed Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sat, 27 Aug 2022 02:34:29 -0400 Subject: [PATCH] Adds elapsed to stopwatch --- src/system/stopwatch.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/system/stopwatch.ts b/src/system/stopwatch.ts index 41f85c2..0494279 100644 --- a/src/system/stopwatch.ts +++ b/src/system/stopwatch.ts @@ -54,6 +54,11 @@ export class Stopwatch { } } + elapsed(): number { + const [secs, nanosecs] = hrtime(this.time); + return secs * 1000 + Math.floor(nanosecs / 1000000); + } + log(options?: StopwatchLogOptions): void { this.logCore(this.scope, options, false); }