std.posix: Use separate clock ID enums for clock_gettime() and timerfd_create() (#22627)

This commit is contained in:
Chris Boesch
2025-02-01 07:53:57 +01:00
committed by GitHub
parent c44be99f1a
commit 58c00a829e
6 changed files with 63 additions and 23 deletions

View File

@@ -543,7 +543,7 @@ const PosixImpl = struct {
// This can be changed with pthread_condattr_setclock, but it's an extension and may not be available everywhere.
var ts: c.timespec = undefined;
if (timeout) |timeout_ns| {
std.posix.clock_gettime(c.CLOCK.REALTIME, &ts) catch unreachable;
ts = std.posix.clock_gettime(c.CLOCK.REALTIME) catch unreachable;
ts.sec +|= @as(@TypeOf(ts.sec), @intCast(timeout_ns / std.time.ns_per_s));
ts.nsec += @as(@TypeOf(ts.nsec), @intCast(timeout_ns % std.time.ns_per_s));