authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-27 17:03:16-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-10-29 06:20:51-07:00
logcc4931b3258ec764f0769ee573ed8a2989664d3a
tree4ed6fa598ca202cda1d3cf8c2e8a78bd514cf891
parentc8739d6953b62de30827a484f94cc8add8c22dd9

std.Io.Threaded: fix 32-bit overflow in lookupDns

be a little more careful with nanoseconds

1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/Io/Threaded.zig+1-1
...@@ -5235,7 +5235,7 @@ fn lookupDns(...@@ -5235,7 +5235,7 @@ fn lookupDns(
5235 var now_ts = try clock.now(t_io);5235 var now_ts = try clock.now(t_io);
5236 const final_ts = now_ts.addDuration(.fromSeconds(rc.timeout_seconds));5236 const final_ts = now_ts.addDuration(.fromSeconds(rc.timeout_seconds));
5237 const attempt_duration: Io.Duration = .{5237 const attempt_duration: Io.Duration = .{
5238 .nanoseconds = std.time.ns_per_s * @as(usize, rc.timeout_seconds) / rc.attempts,5238 .nanoseconds = (std.time.ns_per_s / rc.attempts) * @as(i96, rc.timeout_seconds),
5239 };5239 };
52405240
5241 send: while (now_ts.nanoseconds < final_ts.nanoseconds) : (now_ts = try clock.now(t_io)) {5241 send: while (now_ts.nanoseconds < final_ts.nanoseconds) : (now_ts = try clock.now(t_io)) {