
header "sys" as sys

+ fn sleep_ns(ns: uint) void {
	#if OS == win
	sys:Sleep(1)
	#else
    let nsec = ns.@cast(int)
    let ts = @stack(<sys:libc_timespec>)
    ts.tv_sec = nsec / 1000000000
    ts.tv_nsec = (nsec % 1000000000)
    sys:nanosleep(ts, ts)
	#end
}

+ fn sleep_ms(ms: uint) void {
    sleep_ns(ms * 1000)
}
