std.Io.Threaded: better clock lowering for BSDs

This commit is contained in:
Andrew Kelley 2025-10-27 16:34:35 -07:00
parent 80a341b411
commit 3de1b6c9a9

View File

@ -5009,7 +5009,12 @@ fn clockToPosix(clock: Io.Clock) posix.clockid_t {
// On freebsd derivatives, use MONOTONIC_FAST as currently there's
// no precision tradeoff.
.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_thread => posix.CLOCK.THREAD_CPUTIME_ID,