-
- Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
Version: v7.10.0
Platform: Windows 10 64-bit
Subsystem: fs
I was working on a fuzz test to test the accuracy of timestamps set using fs.utimes() and found the following two precision bugs on Windows:
NEGATIVE MTIME: expect mtime=2159345162531 actual mtime=-2135622133469 INACCURATE MTIME: expect mtime=1713037251360 actual mtime=1713037251359 Here's the gist to reproduce (on a Windows fs with support for at least millisecond timestamps):
var fs = require('fs'); var path = 'test-utimes-precision'; fs.writeFileSync(path, ''); console.log('\r\nNEGATIVE MTIME:'); var mtime = 2159345162531; fs.utimesSync(path, mtime / 1000, mtime / 1000); var stats = fs.statSync(path); console.log('expect mtime=' + mtime); // 2159345162531 console.log('actual mtime=' + stats.mtime.getTime()); // -2135622133469 console.log('\r\nINACCURATE MTIME:'); var mtime = 1713037251360; fs.utimesSync(path, mtime / 1000, mtime / 1000); var stats = fs.statSync(path); console.log('expect mtime=' + mtime); // 1713037251360 console.log('actual mtime=' + stats.mtime.getTime()); // 1713037251359On Mac, the negative mtime is also an issue.
Metadata
Metadata
Assignees
Labels
fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.