We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c72506c commit b6326ceCopy full SHA for b6326ce
lib/internal/fs/utils.js
@@ -286,6 +286,12 @@ function nsFromTimeSpecBigInt(sec, nsec) {
286
return sec * kNsPerSecBigInt + nsec;
287
}
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
295
function dateFromMs(ms) {
296
return new Date(Number(ms) + 0.5);
297
0 commit comments