authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-11-15 17:14:12-08:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2025-11-15 17:14:12-08:00
log6ecf497714e9ff9454b4f54e2636219f83584662
tree59231a56442e20cd879b03c2a3983d1d708ab451
parent83d9a5968fb9b8aab8391c386bfa6fb062d22739
parent868413007f8cec8bed6d4bef446c0fa9cdaf6da0
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #25936 from Traxar/master

Add some missing features to `std.Io.Timestamp` and `spirv/CodeGen.zig`

2 files changed, 12 insertions(+), 0 deletions(-)

lib/std/Io.zig+4
...@@ -903,6 +903,10 @@ pub const Timestamp = struct {...@@ -903,6 +903,10 @@ pub const Timestamp = struct {
903 return .{ .nanoseconds = x };903 return .{ .nanoseconds = x };
904 }904 }
905905
906 pub fn toMilliseconds(t: Timestamp) i64 {
907 return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_ms));
908 }
909
906 pub fn toSeconds(t: Timestamp) i64 {910 pub fn toSeconds(t: Timestamp) i64 {
907 return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_s));911 return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_s));
908 }912 }
src/codegen/spirv/CodeGen.zig+8
...@@ -2176,6 +2176,14 @@ const UnaryOp = enum {...@@ -2176,6 +2176,14 @@ const UnaryOp = enum {
2176 .ceil => .Ceil,2176 .ceil => .Ceil,
2177 .trunc => .Trunc,2177 .trunc => .Trunc,
2178 .round => .Round,2178 .round => .Round,
2179 .sin => .Sin,
2180 .cos => .Cos,
2181 .tan => .Tan,
2182 .sqrt => .Sqrt,
2183 .exp => .Exp,
2184 .exp2 => .Exp2,
2185 .log => .Log,
2186 .log2 => .Log2,
2179 else => return null,2187 else => return null,
2180 })),2188 })),
2181 else => unreachable,2189 else => unreachable,