-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utimes precision errors #13255
Comments
Actually on Mac, there is no issue, only Windows. |
I think the negative mtime has to do with a limit in NTFS (https://articles.forensicfocus.com/2013/04/06/interpretation-of-ntfs-timestamps/). |
That leaves the rounding error. Perhaps there could be an exception for an mtime that would overflow NTFS on Windows. |
Hello @jorangreef , we already have a fix for the second issue (the bad rounding of time) #12607 (and it's spinoff #12818). |
Regarding an exception for an mtime that would overflow NTFS on Windows and lead to a negative mtime returned by fs.stats:
Anything more than that overflows NTFS' internal structures. statSync then returns a valid Date object, but the getTime() on this Date object returns a negative Unix timestamp (negative relative to the Unix epoch). |
@jorangreef It's not exactly an overflow, it's just bad interpretation. I think I have a fix in #13281 |
PR-URL: nodejs#13281 Fixes: nodejs#13255 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
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:Here's the gist to reproduce (on a Windows fs with support for at least millisecond timestamps):
On Mac, the negative mtime is also an issue.
The text was updated successfully, but these errors were encountered: