| ... | ... | @@ -2315,19 +2315,6 @@ pub fn realpathW(pathname: [*]const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPa |
| 2315 | 2315 | |
| 2316 | 2316 | /// Spurious wakeups are possible and no precision of timing is guaranteed. |
| 2317 | 2317 | pub fn nanosleep(seconds: u64, nanoseconds: u64) void { |
| 2318 | | if (windows.is_the_target and !builtin.link_libc) { |
| 2319 | | // TODO https://github.com/ziglang/zig/issues/1284 |
| 2320 | | const small_s = math.cast(windows.DWORD, seconds) catch math.maxInt(windows.DWORD); |
| 2321 | | const ms_from_s = math.mul(windows.DWORD, small_s, std.time.ms_per_s) catch math.maxInt(windows.DWORD); |
| 2322 | | |
| 2323 | | const ns_per_ms = std.time.ns_per_s / std.time.ms_per_s; |
| 2324 | | const big_ms_from_ns = nanoseconds / ns_per_ms; |
| 2325 | | const ms_from_ns = math.cast(windows.DWORD, big_ms_from_ns) catch math.maxInt(windows.DWORD); |
| 2326 | | |
| 2327 | | const ms = math.add(windows.DWORD, ms_from_s, ms_from_ns) catch math.maxInt(windows.DWORD); |
| 2328 | | windows.kernel32.Sleep(ms); |
| 2329 | | return; |
| 2330 | | } |
| 2331 | 2318 | var req = timespec{ |
| 2332 | 2319 | .tv_sec = math.cast(isize, seconds) catch math.maxInt(isize), |
| 2333 | 2320 | .tv_nsec = math.cast(isize, nanoseconds) catch math.maxInt(isize), |