utimensat/AT_FDCWD do not exist on Windows. Set the same instant through * SetFileTime: FILETIME is 100ns ticks since 1601, the same representation * cbm_path_info_utf8 reads back, so the round-trip loses nothing the * incremental pipeline can observe. */
| 3407 | * cbm_path_info_utf8 reads back, so the round-trip loses nothing the |
| 3408 | * incremental pipeline can observe. */ |
| 3409 | static int pipeline_test_set_mtime(const char *path, time_t seconds, long nanoseconds) { |
| 3410 | uint64_t ticks = (uint64_t)seconds * UINT64_C(10000000) + (uint64_t)nanoseconds / 100U + |
| 3411 | UINT64_C(116444736000000000); |
| 3412 | FILETIME ft = {.dwLowDateTime = (DWORD)(ticks & 0xFFFFFFFFU), |
| 3413 | .dwHighDateTime = (DWORD)(ticks >> 32)}; |
| 3414 | wchar_t *wpath = cbm_utf8_to_wide(path); |
| 3415 | if (!wpath) { |
| 3416 | return -1; |
| 3417 | } |
| 3418 | HANDLE h = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, |
| 3419 | OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); |
| 3420 | free(wpath); |
| 3421 | if (h == INVALID_HANDLE_VALUE) { |
| 3422 | return -1; |
| 3423 | } |
| 3424 | BOOL ok = SetFileTime(h, NULL, &ft, &ft); |
| 3425 | CloseHandle(h); |
| 3426 | return ok ? 0 : -1; |
| 3427 | } |
| 3428 | #else |
| 3429 | static int pipeline_test_set_mtime(const char *path, time_t seconds, long nanoseconds) { |
| 3430 | struct timespec times[2] = {{.tv_sec = seconds, .tv_nsec = nanoseconds}, |
no test coverage detected