mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 14:23:09 +00:00
std.Io.Threaded: fix 32-bit overflow in lookupDns
be a little more careful with nanoseconds
This commit is contained in:
parent
c8739d6953
commit
cc4931b325
@ -5235,7 +5235,7 @@ fn lookupDns(
|
|||||||
var now_ts = try clock.now(t_io);
|
var now_ts = try clock.now(t_io);
|
||||||
const final_ts = now_ts.addDuration(.fromSeconds(rc.timeout_seconds));
|
const final_ts = now_ts.addDuration(.fromSeconds(rc.timeout_seconds));
|
||||||
const attempt_duration: Io.Duration = .{
|
const attempt_duration: Io.Duration = .{
|
||||||
.nanoseconds = std.time.ns_per_s * @as(usize, rc.timeout_seconds) / rc.attempts,
|
.nanoseconds = (std.time.ns_per_s / rc.attempts) * @as(i96, rc.timeout_seconds),
|
||||||
};
|
};
|
||||||
|
|
||||||
send: while (now_ts.nanoseconds < final_ts.nanoseconds) : (now_ts = try clock.now(t_io)) {
|
send: while (now_ts.nanoseconds < final_ts.nanoseconds) : (now_ts = try clock.now(t_io)) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user