diff --git a/lib/std/os.zig b/lib/std/os.zig index 12cda72e400a..1e99efc44c91 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -5338,11 +5338,13 @@ pub fn getFdPath(fd: fd_t, out_buffer: *[MAX_PATH_BYTES]u8) RealPathError![]u8 { } } +const nanosize = if (is_windows) c_long else isize; + /// Spurious wakeups are possible and no precision of timing is guaranteed. pub fn nanosleep(seconds: u64, nanoseconds: u64) void { var req = timespec{ .tv_sec = math.cast(isize, seconds) orelse math.maxInt(isize), - .tv_nsec = math.cast(isize, nanoseconds) orelse math.maxInt(isize), + .tv_nsec = math.cast(nanosize, nanoseconds) orelse math.maxInt(nanosize), }; var rem: timespec = undefined; while (true) {