diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-05-13 00:38:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-12 23:38:22 +0000 |
commit | 03a76f33ad0808c659116721a757958ad054dd25 (patch) | |
tree | bd985775693d065522331ef99af46a92aded8288 /ext/node | |
parent | 2b62a5b8140f884c35a4e1ae732a9de3dd8c6114 (diff) |
fix(ext/node): process.uptime works without this (#23786)
Fixes https://github.com/denoland/deno/issues/23761
Co-authored-by: Satya Rohith <me@satyarohith.com>
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/process.ts | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index b24bf6a8e..1a96af2a2 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -668,14 +668,9 @@ class Process extends EventEmitter { execPath = path; } - setStartTime(t: number) { - this.#startTime = t; - } - - #startTime = 0; /** https://nodejs.org/api/process.html#processuptime */ uptime() { - return (Date.now() - this.#startTime) / 1000; + return Number((performance.now() / 1000).toFixed(9)); } #allowedFlags = buildAllowedFlags(); @@ -887,16 +882,12 @@ internals.__bootstrapNodeProcess = function ( ); } - process.setStartTime(Date.now()); - arch = arch_(); platform = isWindows ? "win32" : Deno.build.os; pid = Deno.pid; initializeDebugEnv(nodeDebug); - // @ts-ignore Remove setStartTime and #startTime is not modifiable - delete process.setStartTime; delete internals.__bootstrapNodeProcess; } else { // Warmup, assuming stdin/stdout/stderr are all terminals |