aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-22 21:00:39 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:12 -0800
commite9da2783ce3c65d8e8e8533b7c70ec5a867f830a (patch)
treea30fea7b2179f53e15fc1856a7caf5b822d7f095 /lib/std
parent691afee786d095fef2a7abed73efa035feef3f4e (diff)
downloadzig-e9da2783ce3c65d8e8e8533b7c70ec5a867f830a.tar.gz
zig-e9da2783ce3c65d8e8e8533b7c70ec5a867f830a.zip
std.Io.Threaded: add a workaround for self-hosted wasm backend
Tracked by #30575
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/Io/Threaded.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig
index 2f6772efd8..1c7d848aae 100644
--- 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)),