commit e9da2783ce3c65d8e8e8533b7c70ec5a867f830a (tree)
parent 691afee786d095fef2a7abed73efa035feef3f4e
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 22 Dec 2025 21:00:39 -0800
std.Io.Threaded: add a workaround for self-hosted wasm backend
Tracked by #30575
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
@@ -11085,6 +11085,13 @@ fn timestampFromPosix(timespec: *const posix.timespec) Io.Timestamp {
}
fn timestampToPosix(nanoseconds: i96) posix.timespec {
+ if (builtin.zig_backend == .stage2_wasm) {
+ // Workaround for https://codeberg.org/ziglang/zig/issues/30575
+ return .{
+ .sec = @intCast(@divTrunc(nanoseconds, std.time.ns_per_s)),
+ .nsec = @intCast(@rem(nanoseconds, std.time.ns_per_s)),
+ };
+ }
return .{
.sec = @intCast(@divFloor(nanoseconds, std.time.ns_per_s)),
.nsec = @intCast(@mod(nanoseconds, std.time.ns_per_s)),