summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/process.ts
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-02-22 00:14:15 +0900
committerGitHub <noreply@github.com>2023-02-22 00:14:15 +0900
commit608c855f1166e0ed76762fd9afd00bb52cc65032 (patch)
tree885473c25a25ce2cd16736790c56fc3bb262fbe5 /ext/node/polyfills/process.ts
parent914b08fc19e5c7268e7b04a216337e765d6a06e8 (diff)
fix(ext/node): fix process.uptime (#17839)
Diffstat (limited to 'ext/node/polyfills/process.ts')
-rw-r--r--ext/node/polyfills/process.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts
index 42c55ccc5..779eefb8c 100644
--- a/ext/node/polyfills/process.ts
+++ b/ext/node/polyfills/process.ts
@@ -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;
};