| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 366c983 commit e89a39b
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -286,6 +286,12 @@ function nsFromTimeSpecBigInt(sec, nsec) { | |||
| 286 | 286 | return sec * kNsPerSecBigInt + nsec; | |
| 287 | 287 | } | |
| 288 | 288 | ||
| 289 | + // The Date constructor performs Math.floor() to the timestamp. | ||
| 290 | + // https://www.ecma-international.org/ecma-262/#sec-timeclip | ||
| 291 | + // Since there may be a precision loss when the timestamp is | ||
| 292 | + // converted to a floating point number, we manually round | ||
| 293 | + // the timestamp here before passing it to Date(). | ||
| 294 | + // Refs: https://github.com/nodejs/node/pull/12607 | ||
| 289 | 295 | function dateFromMs(ms) { | |
| 290 | 296 | return new Date(Number(ms) + 0.5); | |
| 291 | 297 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments