-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Windows: Setting fs.futimes{Sync} subsecond (millisecond) precision? #2069
Comments
I think you have a bug in your example. You are passing @nodejs/documentation The documentation can probably be improved, the above isn't mentioned; ditto for |
Never mind, I see lib/fs.js already handles |
Output of the script on Windows 10 (NTFS):
|
NTFS and FAT only have 2s resolution for file times don't they? |
NTFS has 100 nanosecond precision |
At INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
FILETIME filetime_a, filetime_m;
TIME_T_TO_FILETIME((time_t) atime, &filetime_a);
TIME_T_TO_FILETIME((time_t) mtime, &filetime_m);
if (!SetFileTime(handle, NULL, &filetime_a, &filetime_m)) {
return -1;
}
return 0;
}
I haven't tested this on Windows though. Just checked the docs. |
@imyller |
@mathiask88 Ok, Code is still casting a double to int and losing the milliseconds in fractional part. |
If the floating part of the double contains sub second precision can't it be adjusted so the int64 actually represents time in ns? |
I think it would be possible to use 100ns precision using NtSetInformationFile. |
@imyller is right though, isn't he? The cast to time_t loses the sub-second precision. Shouldn't this patch fix it? diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c
index 00d0197..7608737 100644
--- a/deps/uv/src/win/fs.c
+++ b/deps/uv/src/win/fs.c
@@ -1398,8 +1398,8 @@ static void fs__fchmod(uv_fs_t* req) {
INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
FILETIME filetime_a, filetime_m;
- TIME_T_TO_FILETIME((time_t) atime, &filetime_a);
- TIME_T_TO_FILETIME((time_t) mtime, &filetime_m);
+ TIME_T_TO_FILETIME(atime, &filetime_a);
+ TIME_T_TO_FILETIME(mtime, &filetime_m);
if (!SetFileTime(handle, NULL, &filetime_a, &filetime_m)) {
return -1; |
This test will not pass until it would be fixed in nodejs See: nodejs/node#2069
This test will not pass until it would be fixed in nodejs See: nodejs/node#2069
@piscisaureus ... this would need to be fixed in libuv correct? |
I've filed libuv/libuv#800. |
The fix was accepted: libuv/libuv@399e2c8. It should be available in libuv version 1.10.0. |
Sorry, forgot to close out. It's been fixed in libuv/libuv#849, released in libuv v1.10.0 and node.js v7.1.0, and will eventually be available in a v4.x and v6.x LTS release. |
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
Lot of nodejs versions are buggy on windows regarding utime : It's not setting the milliseconds part. Issue: nodejs/node#2069 With this change file date comparison is now done with only seconds precision on windows when copying files. It make linking fast again under windows.
According to nodejs/node-v0.x-archive#7000 (comment) this should be supported.
You can run the same snippet that TJ Fontaine posted in an aforementioned issue:
The output on Windows 7 / NTFS does not match the output he posted. i.e. it's missing milliseconds.
io.js version:
v2.3.1
.The text was updated successfully, but these errors were encountered: