Description
What is the problem this feature will solve?
Sometimes one only wants to modify access time, not modification time or vice versa.
I'm working on the Emscripten where we have an implementation of a linux file system backed by the node fs module. The utimens
family of functions are supposed to leave the time value alone if UTIME_OMIT
is passed in the nanosecond field.
What is the feature you are proposing to solve the problem?
It would be convenient if FS.utime(path, atime, undefined)
would update the atime and leave the mtime alone, and vice versa.
node uses libuv to call utimens itself, but the libuv api only takes doubles and converts from them to fill the tv_nsec struct with uv__fs_to_timeval
. It's not possible to make a double that is converted to UTIME_OMIT
because uv__fs_to_timeval
rounds the nanosecond field: https://github.com/libuv/libuv/blame/v1.x/src/unix/fs.c#L216. So libuv would need to be updated to support this. At the same time it could also be changed to support higher precision times #50859.
What alternatives have you considered?
Stat the file and use the stat to fill the time I want unchanged. Because of #50859, this will round trip the time through a double and so leave it only approximately unchanged not exactly unchanged.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status