mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.Io.Threaded: better clock lowering for BSDs
This commit is contained in:
parent
80a341b411
commit
3de1b6c9a9
@ -5009,7 +5009,12 @@ fn clockToPosix(clock: Io.Clock) posix.clockid_t {
|
|||||||
// On freebsd derivatives, use MONOTONIC_FAST as currently there's
|
// On freebsd derivatives, use MONOTONIC_FAST as currently there's
|
||||||
// no precision tradeoff.
|
// no precision tradeoff.
|
||||||
.freebsd, .dragonfly => posix.CLOCK.MONOTONIC_FAST,
|
.freebsd, .dragonfly => posix.CLOCK.MONOTONIC_FAST,
|
||||||
else => posix.CLOCK.BOOTTIME,
|
// On linux, use BOOTTIME instead of MONOTONIC as it ticks while
|
||||||
|
// suspended.
|
||||||
|
.linux => posix.CLOCK.BOOTTIME,
|
||||||
|
// On other posix systems, MONOTONIC is generally the fastest and
|
||||||
|
// ticks while suspended.
|
||||||
|
else => posix.CLOCK.MONOTONIC,
|
||||||
},
|
},
|
||||||
.cpu_process => posix.CLOCK.PROCESS_CPUTIME_ID,
|
.cpu_process => posix.CLOCK.PROCESS_CPUTIME_ID,
|
||||||
.cpu_thread => posix.CLOCK.THREAD_CPUTIME_ID,
|
.cpu_thread => posix.CLOCK.THREAD_CPUTIME_ID,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user