Skip to content

Commit cb7af83

Browse files
committed
posix.clock_gettime now returns a ts rather than takes a ptr to update one
1 parent 46753ab commit cb7af83

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Diff for: src/worker.zig

+2-3
Original file line numberDiff line numberDiff line change
@@ -1675,12 +1675,11 @@ pub const HTTPConn = struct {
16751675
};
16761676

16771677
pub fn timestamp(clamp: u32) u32 {
1678-
if (comptime @hasDecl(posix, "CLOCK") == false or posix.CLOCK == void) {
1678+
if (comptime @hasDecl(posix, "CLOCK") == false or posix.CLOCK == void) {
16791679
const value: u32 = @intCast(std.time.timestamp());
16801680
return if (value <= clamp) return clamp + 1 else value;
16811681
}
1682-
var ts: posix.timespec = undefined;
1683-
posix.clock_gettime(posix.CLOCK.MONOTONIC, &ts) catch unreachable;
1682+
const ts = posix.clock_gettime(posix.CLOCK.MONOTONIC) catch unreachable;
16841683
return @intCast(ts.sec);
16851684
}
16861685

0 commit comments

Comments
 (0)