@@ -1163,6 +1163,9 @@ added: v0.7.6
1163
1163
* ` time ` {integer[ ] } The result of a previous call to ` process.hrtime() `
1164
1164
* Returns: {integer[ ] }
1165
1165
1166
+ This is the legacy version of [ ` process.hrtime.bigint() ` ] [ ]
1167
+ before ` bigint ` was introduced in JavaScript.
1168
+
1166
1169
The ` process.hrtime() ` method returns the current high-resolution real time
1167
1170
in a ` [seconds, nanoseconds] ` tuple ` Array ` , where ` nanoseconds ` is the
1168
1171
remaining part of the real time that can't be represented in second precision.
@@ -1191,6 +1194,33 @@ setTimeout(() => {
1191
1194
}, 1000 );
1192
1195
```
1193
1196
1197
+ ## process.hrtime.bigint()
1198
+ <!-- YAML
1199
+ added: REPLACEME
1200
+ -->
1201
+
1202
+ * Returns: {bigint}
1203
+
1204
+ The ` bigint ` version of the [ ` process.hrtime() ` ] [ ] method returning the
1205
+ current high-resolution real time in a ` bigint ` .
1206
+
1207
+ Unlike [ ` process.hrtime() ` ] [ ] , it does not support an additional ` time `
1208
+ argument since the difference can just be computed directly
1209
+ by subtraction of the two ` bigint ` s.
1210
+
1211
+ ``` js
1212
+ const start = process .hrtime .bigint ();
1213
+ // 191051479007711n
1214
+
1215
+ setTimeout (() => {
1216
+ const end = process .hrtime .bigint ();
1217
+ // 191052633396993n
1218
+
1219
+ console .log (` Benchmark took ${ end - start} nanoseconds` );
1220
+ // Benchmark took 1154389282 nanoseconds
1221
+ }, 1000 );
1222
+ ```
1223
+
1194
1224
## process.initgroups(user, extraGroup)
1195
1225
<!-- YAML
1196
1226
added: v0.9.4
@@ -2035,6 +2065,8 @@ cases:
2035
2065
[ `process.execPath` ] : #process_process_execpath
2036
2066
[ `process.exit()` ] : #process_process_exit_code
2037
2067
[ `process.exitCode` ] : #process_process_exitcode
2068
+ [ `process.hrtime()` ] : #process_process_hrtime_time
2069
+ [ `process.hrtime.bigint()` ] : #process_process_hrtime_bigint
2038
2070
[ `process.kill()` ] : #process_process_kill_pid_signal
2039
2071
[ `process.setUncaughtExceptionCaptureCallback()` ] : process.html#process_process_setuncaughtexceptioncapturecallback_fn
2040
2072
[ `promise.catch()` ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch
0 commit comments