mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Merge pull request #25936 from Traxar/master
Add some missing features to `std.Io.Timestamp` and `spirv/CodeGen.zig`
This commit is contained in:
commit
6ecf497714
2 changed files with 12 additions and 0 deletions
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue