Merge pull request #25936 from Traxar/master

Add some missing features to `std.Io.Timestamp` and `spirv/CodeGen.zig`
This commit is contained in:
Andrew Kelley 2025-11-15 17:14:12 -08:00 committed by GitHub
commit 6ecf497714
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -903,6 +903,10 @@ pub const Timestamp = struct {
return .{ .nanoseconds = x }; return .{ .nanoseconds = x };
} }
pub fn toMilliseconds(t: Timestamp) i64 {
return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_ms));
}
pub fn toSeconds(t: Timestamp) i64 { pub fn toSeconds(t: Timestamp) i64 {
return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_s)); return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_s));
} }

View file

@ -2176,6 +2176,14 @@ const UnaryOp = enum {
.ceil => .Ceil, .ceil => .Ceil,
.trunc => .Trunc, .trunc => .Trunc,
.round => .Round, .round => .Round,
.sin => .Sin,
.cos => .Cos,
.tan => .Tan,
.sqrt => .Sqrt,
.exp => .Exp,
.exp2 => .Exp2,
.log => .Log,
.log2 => .Log2,
else => return null, else => return null,
})), })),
else => unreachable, else => unreachable,