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