From 73f53b34501e9f970451e360f2804cce2e50d0e9 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sat, 11 Jul 2026 23:47:24 -0700 Subject: [PATCH] allow Duration to be signed to handle moments in the future --- time.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/time.zig b/time.zig index a2453766ff0d844e3b97d01e7e6c2c43e2131075..b92dc42aaf297f6ba9dc6da4f5d3aace54faaf67 100644 --- a/time.zig +++ b/time.zig @@ -426,9 +426,9 @@ pub const DateTime = struct { X, // unix }; - pub fn since(self: DateTime, other_in_the_past: DateTime) Duration { + pub fn since(self: DateTime, other: DateTime) Duration { return Duration{ - .ms = self.toUnixMilli() - other_in_the_past.toUnixMilli(), + .ms = @as(i64, @intCast(self.toUnixMilli())) - @as(i64, @intCast(other.toUnixMilli())), }; } @@ -548,7 +548,7 @@ fn toTuple(array: anytype) @Tuple(&@as([array.len]type, @splat(std.meta.Child(@T } pub const Duration = struct { - ms: u64, + ms: i64, }; // Divisions of a nanosecond. -- 2.54.0