Skip to content

Commit bf44c3f

Browse files
unix: support nanosecond resolution in uv__fs_to_timespec (libuv#4951)
Remove the microsecond truncation in uv__fs_to_timespec() function to enable full nanosecond resolution support. The utimensat() system call already supports nanosecond precision, so the artificial truncation to microseconds is no longer necessary. This allows file modification and access times to be set with full nanosecond precision instead of being limited to microsecond resolution. Fixes the TODO comment about removing the microsecond resolution limit.
1 parent 8fc7034 commit bf44c3f

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

src/unix/fs.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,6 @@ static struct timespec uv__fs_to_timespec(double time) {
224224
ts.tv_sec = time;
225225
ts.tv_nsec = (time - ts.tv_sec) * 1e9;
226226

227-
/* TODO(bnoordhuis) Remove this. utimesat() has nanosecond resolution but we
228-
* stick to microsecond resolution for the sake of consistency with other
229-
* platforms. I'm the original author of this compatibility hack but I'm
230-
* less convinced it's useful nowadays.
231-
*/
232-
ts.tv_nsec -= ts.tv_nsec % 1000;
233-
234227
if (ts.tv_nsec < 0) {
235228
ts.tv_nsec += 1e9;
236229
ts.tv_sec -= 1;

0 commit comments

Comments
 (0)