mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std/Io.zig Timestamp: add toMilliseconds()
This commit is contained in:
parent
250803661c
commit
19c9062840
1 changed files with 4 additions and 0 deletions
|
|
@ -903,6 +903,10 @@ pub const Timestamp = struct {
|
|||
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 {
|
||||
return @intCast(@divTrunc(t.nanoseconds, std.time.ns_per_s));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue