You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: types/node/process.d.ts
+35-2
Original file line number
Diff line number
Diff line change
@@ -333,11 +333,43 @@ declare module "process" {
333
333
TZ?: string;
334
334
}
335
335
interfaceHRTime{
336
+
/**
337
+
* This is the legacy version of {@link process.hrtime.bigint()}
338
+
* before bigint was introduced in JavaScript.
339
+
*
340
+
* The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
341
+
* where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
342
+
*
343
+
* `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
344
+
* If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
345
+
* Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
346
+
*
347
+
* These times are relative to an arbitrary time in the past,
348
+
* and not related to the time of day and therefore not subject to clock drift.
349
+
* The primary use is for measuring performance between intervals:
350
+
* ```js
351
+
* const { hrtime } = require('node:process');
352
+
* const NS_PER_SEC = 1e9;
353
+
* const time = hrtime();
354
+
* // [ 1800216, 25 ]
355
+
*
356
+
* setTimeout(() => {
357
+
* const diff = hrtime(time);
358
+
* // [ 1, 552 ]
359
+
*
360
+
* console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
361
+
* // Benchmark took 1000000552 nanoseconds
362
+
* }, 1000);
363
+
* ```
364
+
* @since 0.7.6
365
+
* @legacy Use {@link process.hrtime.bigint()} instead.
366
+
* @param time The result of a previous call to `process.hrtime()`
367
+
*/
336
368
(time?: [number,number]): [number,number];
337
369
/**
338
-
* The `bigint` version of the `{@link hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
370
+
* The `bigint` version of the {@linkprocess.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
339
371
*
340
-
* Unlike `{@link hrtime()}`, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
372
+
* Unlike {@linkprocess.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
Copy file name to clipboardexpand all lines: types/node/v16/process.d.ts
+52
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,59 @@ declare module "process" {
130
130
TZ?: string;
131
131
}
132
132
interfaceHRTime{
133
+
/**
134
+
* This is the legacy version of {@link process.hrtime.bigint()}
135
+
* before bigint was introduced in JavaScript.
136
+
*
137
+
* The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
138
+
* where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
139
+
*
140
+
* `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
141
+
* If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
142
+
* Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
143
+
*
144
+
* These times are relative to an arbitrary time in the past,
145
+
* and not related to the time of day and therefore not subject to clock drift.
146
+
* The primary use is for measuring performance between intervals:
147
+
* ```js
148
+
* const { hrtime } = require('node:process');
149
+
* const NS_PER_SEC = 1e9;
150
+
* const time = hrtime();
151
+
* // [ 1800216, 25 ]
152
+
*
153
+
* setTimeout(() => {
154
+
* const diff = hrtime(time);
155
+
* // [ 1, 552 ]
156
+
*
157
+
* console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
158
+
* // Benchmark took 1000000552 nanoseconds
159
+
* }, 1000);
160
+
* ```
161
+
* @since 0.7.6
162
+
* @legacy Use {@link process.hrtime.bigint()} instead.
163
+
* @param time The result of a previous call to `process.hrtime()`
164
+
*/
133
165
(time?: [number,number]): [number,number];
166
+
/**
167
+
* The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
168
+
*
169
+
* Unlike {@link process.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
170
+
* ```js
171
+
* import { hrtime } from 'node:process';
172
+
*
173
+
* const start = hrtime.bigint();
174
+
* // 191051479007711n
175
+
*
176
+
* setTimeout(() => {
177
+
* const end = hrtime.bigint();
178
+
* // 191052633396993n
179
+
*
180
+
* console.log(`Benchmark took ${end - start} nanoseconds`);
Copy file name to clipboardexpand all lines: types/node/v18/process.d.ts
+52
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,59 @@ declare module "process" {
141
141
TZ?: string;
142
142
}
143
143
interfaceHRTime{
144
+
/**
145
+
* This is the legacy version of {@link process.hrtime.bigint()}
146
+
* before bigint was introduced in JavaScript.
147
+
*
148
+
* The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
149
+
* where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
150
+
*
151
+
* `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
152
+
* If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
153
+
* Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
154
+
*
155
+
* These times are relative to an arbitrary time in the past,
156
+
* and not related to the time of day and therefore not subject to clock drift.
157
+
* The primary use is for measuring performance between intervals:
158
+
* ```js
159
+
* const { hrtime } = require('node:process');
160
+
* const NS_PER_SEC = 1e9;
161
+
* const time = hrtime();
162
+
* // [ 1800216, 25 ]
163
+
*
164
+
* setTimeout(() => {
165
+
* const diff = hrtime(time);
166
+
* // [ 1, 552 ]
167
+
*
168
+
* console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
169
+
* // Benchmark took 1000000552 nanoseconds
170
+
* }, 1000);
171
+
* ```
172
+
* @since 0.7.6
173
+
* @legacy Use {@link process.hrtime.bigint()} instead.
174
+
* @param time The result of a previous call to `process.hrtime()`
175
+
*/
144
176
(time?: [number,number]): [number,number];
177
+
/**
178
+
* The `bigint` version of the {@link process.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
179
+
*
180
+
* Unlike {@link process.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
181
+
* ```js
182
+
* import { hrtime } from 'node:process';
183
+
*
184
+
* const start = hrtime.bigint();
185
+
* // 191051479007711n
186
+
*
187
+
* setTimeout(() => {
188
+
* const end = hrtime.bigint();
189
+
* // 191052633396993n
190
+
*
191
+
* console.log(`Benchmark took ${end - start} nanoseconds`);
Copy file name to clipboardexpand all lines: types/node/v20/process.d.ts
+35-2
Original file line number
Diff line number
Diff line change
@@ -273,11 +273,43 @@ declare module "process" {
273
273
TZ?: string;
274
274
}
275
275
interfaceHRTime{
276
+
/**
277
+
* This is the legacy version of {@link process.hrtime.bigint()}
278
+
* before bigint was introduced in JavaScript.
279
+
*
280
+
* The `process.hrtime()` method returns the current high-resolution real time in a `[seconds, nanoseconds]` tuple `Array`,
281
+
* where `nanoseconds` is the remaining part of the real time that can't be represented in second precision.
282
+
*
283
+
* `time` is an optional parameter that must be the result of a previous `process.hrtime()` call to diff with the current time.
284
+
* If the parameter passed in is not a tuple `Array`, a TypeError will be thrown.
285
+
* Passing in a user-defined array instead of the result of a previous call to `process.hrtime()` will lead to undefined behavior.
286
+
*
287
+
* These times are relative to an arbitrary time in the past,
288
+
* and not related to the time of day and therefore not subject to clock drift.
289
+
* The primary use is for measuring performance between intervals:
290
+
* ```js
291
+
* const { hrtime } = require('node:process');
292
+
* const NS_PER_SEC = 1e9;
293
+
* const time = hrtime();
294
+
* // [ 1800216, 25 ]
295
+
*
296
+
* setTimeout(() => {
297
+
* const diff = hrtime(time);
298
+
* // [ 1, 552 ]
299
+
*
300
+
* console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
301
+
* // Benchmark took 1000000552 nanoseconds
302
+
* }, 1000);
303
+
* ```
304
+
* @since 0.7.6
305
+
* @legacy Use {@link process.hrtime.bigint()} instead.
306
+
* @param time The result of a previous call to `process.hrtime()`
307
+
*/
276
308
(time?: [number,number]): [number,number];
277
309
/**
278
-
* The `bigint` version of the `{@link hrtime()}` method returning the current high-resolution real time in nanoseconds as a `bigint`.
310
+
* The `bigint` version of the {@linkprocess.hrtime()} method returning the current high-resolution real time in nanoseconds as a `bigint`.
279
311
*
280
-
* Unlike `{@link hrtime()}`, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
312
+
* Unlike {@linkprocess.hrtime()}, it does not support an additional time argument since the difference can just be computed directly by subtraction of the two `bigint`s.
0 commit comments