-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Description
- Version: 10.7.0 / 8.11.3
- Platform: OSX & Linux
- Subsystem: fs
Not sure if it's an implementation issue or a documentation issue, but the following is unexpected:
> var d = new Date(1234567891234);
> fs.utimesSync('./test', d, d);
> fs.statSync('./test').mtimeMs
1234567891000
> fs.futimesSync(fs.openSync('./test', 'w'), d, d);
> fs.statSync('./test').mtimeMs
1234567891234As you can see, the precision is lost (my systems support subsecond precisions - touch manages to change them, and both the stat utility and fs.stat can read them without issues).
The Node documentation also doesn't mention that utimes has a different behavior from futimes (it actually suggest they share the exact same behavior, since futimes redirect to utimes), except possibly in this archived post.
Additionally, the function name (utimes) seem to match the behavior of 2 utime instead of 3 utimes, which seems counterintuitive. The libuv implementation is called uv_fs_utime , which at least hints at the difference of behavior (except that they use uv_fs_futime instead of uv_fs_futimes ..).