doc: update process.hrtime docs to include optional parameter
Adds more explicit documentation for the single optional parameter to process.hrtime to the process docs. PR-URL: https://github.com/nodejs/node/pull/6585 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Robert Jefe Lindstaedt <robert.lindstaedt@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
6306b10c48
commit
e916218ba5
@ -947,15 +947,18 @@ if (process.getuid) {
|
||||
}
|
||||
```
|
||||
|
||||
## process.hrtime()
|
||||
## process.hrtime([time])
|
||||
<!-- YAML
|
||||
added: v0.7.6
|
||||
-->
|
||||
|
||||
Returns the current high-resolution real time in a `[seconds, nanoseconds]`
|
||||
tuple Array. It is relative to an arbitrary time in the past. It is not
|
||||
related to the time of day and therefore not subject to clock drift. The
|
||||
primary use is for measuring performance between intervals.
|
||||
tuple Array. `time` is an optional parameter that must be the result of a
|
||||
previous `process.hrtime()` call (and therefore, a real time in a
|
||||
`[seconds, nanoseconds]` tuple Array containing a previous time) to diff with
|
||||
the current time. These times are relative to an arbitrary time in the past,
|
||||
and not related to the time of day and therefore not subject to clock drift.
|
||||
The primary use is for measuring performance between intervals.
|
||||
|
||||
You may pass in the result of a previous call to `process.hrtime()` to get
|
||||
a diff reading, useful for benchmarks and measuring intervals:
|
||||
@ -973,6 +976,9 @@ setTimeout(() => {
|
||||
}, 1000);
|
||||
```
|
||||
|
||||
Constructing an array by some method other than calling `process.hrtime()` and
|
||||
passing the result to process.hrtime() will result in undefined behavior.
|
||||
|
||||
|
||||
## process.initgroups(user, extra_group)
|
||||
<!-- YAML
|
||||
|
Loading…
x
Reference in New Issue
Block a user