Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/std/os.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down