| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fe23f42 commit a2c257a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -193,10 +193,9 @@ | |||
| 193 | 193 | ||
| 194 | 194 | if (typeof ar !== 'undefined') { | |
| 195 | 195 | if (Array.isArray(ar)) { | |
| 196 | - return [ | ||
| 197 | - (hrValues[0] * 0x100000000 + hrValues[1]) - ar[0], | ||
| 198 | - hrValues[2] - ar[1] | ||
| 199 | - ]; | ||
| 196 | + const sec = (hrValues[0] * 0x100000000 + hrValues[1]) - ar[0]; | ||
| 197 | + const nsec = hrValues[2] - ar[1]; | ||
| 198 | + return [nsec < 0 ? sec - 1 : sec, nsec < 0 ? nsec + 1e9 : nsec]; | ||
| 200 | 199 | } | |
| 201 | 200 | ||
| 202 | 201 | throw new TypeError('process.hrtime() only accepts an Array tuple'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,3 +24,6 @@ function validateTuple(tuple) { | |||
| 24 | 24 | assert(isFinite(v)); | |
| 25 | 25 | }); | |
| 26 | 26 | } | |
| 27 | + | ||
| 28 | + const diff = process.hrtime([0, 1e9 - 1]); | ||
| 29 | + assert(diff[1] >= 0); // https://github.com/nodejs/node/issues/4751 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments