aboutsummaryrefslogtreecommitdiff
path: root/std/os.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-05-27 12:16:32 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-05-27 12:16:32 -0400
commitf1610f6c1ddbb5c2b42d2ecac433b8eff11d5a3a (patch)
tree4fb8fd925fabb7fd7d97f7e0e09e40ad998a9a1d /std/os.zig
parentabf959a0c90418c383cc4f10242dbcc2a2e974fd (diff)
downloadzig-f1610f6c1ddbb5c2b42d2ecac433b8eff11d5a3a.tar.gz
zig-f1610f6c1ddbb5c2b42d2ecac433b8eff11d5a3a.zip
nanosleep: move windows logic to std.time
Diffstat (limited to 'std/os.zig')
-rw-r--r--std/os.zig13
1 files changed, 0 insertions, 13 deletions
diff --git a/std/os.zig b/std/os.zig
index e8d0bcb5ef..35105ed9f8 100644
--- a/std/os.zig
+++ b/std/os.zig
@@ -2315,19 +2315,6 @@ pub fn realpathW(pathname: [*]const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPa
/// Spurious wakeups are possible and no precision of timing is guaranteed.
pub fn nanosleep(seconds: u64, nanoseconds: u64) void {
- if (windows.is_the_target and !builtin.link_libc) {
- // TODO https://github.com/ziglang/zig/issues/1284
- const small_s = math.cast(windows.DWORD, seconds) catch math.maxInt(windows.DWORD);
- const ms_from_s = math.mul(windows.DWORD, small_s, std.time.ms_per_s) catch math.maxInt(windows.DWORD);
-
- const ns_per_ms = std.time.ns_per_s / std.time.ms_per_s;
- const big_ms_from_ns = nanoseconds / ns_per_ms;
- const ms_from_ns = math.cast(windows.DWORD, big_ms_from_ns) catch math.maxInt(windows.DWORD);
-
- const ms = math.add(windows.DWORD, ms_from_s, ms_from_ns) catch math.maxInt(windows.DWORD);
- windows.kernel32.Sleep(ms);
- return;
- }
var req = timespec{
.tv_sec = math.cast(isize, seconds) catch math.maxInt(isize),
.tv_nsec = math.cast(isize, nanoseconds) catch math.maxInt(isize),