mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std/Io.zig Timestamp: add toMilliseconds()
This commit is contained in:
parent
250803661c
commit
19c9062840
@ -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…
x
Reference in New Issue
Block a user