mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 09:31:22 -05:00
fix(ext/node): fix process.uptime (#17839)
This commit is contained in:
parent
914b08fc19
commit
608c855f11
2 changed files with 9 additions and 2 deletions
|
@ -540,7 +540,7 @@
|
|||
"test-process-exit-recursive.js",
|
||||
"test-process-exit.js",
|
||||
"test-process-kill-pid.js",
|
||||
"TODO:test-process-uptime.js",
|
||||
"test-process-uptime.js",
|
||||
"test-promise-unhandled-silent.js",
|
||||
"test-promise-unhandled-throw-handler.js",
|
||||
"TODO:test-punycode.js",
|
||||
|
|
|
@ -647,7 +647,11 @@ class Process extends EventEmitter {
|
|||
execPath = path;
|
||||
}
|
||||
|
||||
#startTime = Date.now();
|
||||
setStartTime(t: number) {
|
||||
this.#startTime = t;
|
||||
}
|
||||
|
||||
#startTime = 0;
|
||||
/** https://nodejs.org/api/process.html#processuptime */
|
||||
uptime() {
|
||||
return (Date.now() - this.#startTime) / 1000;
|
||||
|
@ -762,6 +766,9 @@ internals.__bootstrapNodeProcess = function (
|
|||
"stdout",
|
||||
);
|
||||
|
||||
process.setStartTime(Date.now());
|
||||
// @ts-ignore Remove setStartTime and #startTime is not modifiable
|
||||
delete process.setStartTime;
|
||||
delete internals.__bootstrapNodeProcess;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue