mirror of
https://github.com/ziglang/zig.git
synced 2026-02-20 08:14:48 +00:00
implement std.time.sleep for uefi
This commit is contained in:
parent
2e424e019f
commit
80404cc928
@ -46,6 +46,14 @@ pub fn sleep(nanoseconds: u64) void {
|
||||
return;
|
||||
}
|
||||
|
||||
if (builtin.os.tag == .uefi) {
|
||||
const boot_services = os.uefi.system_table.boot_services.?;
|
||||
const us_from_ns = nanoseconds / ns_per_us;
|
||||
const us = math.cast(usize, us_from_ns) orelse math.maxInt(usize);
|
||||
_ = boot_services.stall(us);
|
||||
return;
|
||||
}
|
||||
|
||||
const s = nanoseconds / ns_per_s;
|
||||
const ns = nanoseconds % ns_per_s;
|
||||
std.os.nanosleep(s, ns);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user