Commit 19c9062840

traxar <trxr2a@gmail.com>
2025-11-15 08:38:33
std/Io.zig Timestamp: add `toMilliseconds()`
1 parent 2508036
Changed files (1)
lib
std
lib/std/Io.zig
@@ -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));
     }