authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-11 23:47:24 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-07-11 23:47:24 -07:00
log73f53b34501e9f970451e360f2804cce2e50d0e9
tree7a9272cc400c04f3f60cb4f8a9023620a3f460b3
parentf61bccceb4dcd8bac9a4aead7671b89751f8c15d
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

allow Duration to be signed to handle moments in the future


1 files changed, 3 insertions(+), 3 deletions(-)

time.zig+3-3
...@@ -426,9 +426,9 @@ pub const DateTime = struct {...@@ -426,9 +426,9 @@ pub const DateTime = struct {
426 X, // unix426 X, // unix
427 };427 };
428428
429 pub fn since(self: DateTime, other_in_the_past: DateTime) Duration {429 pub fn since(self: DateTime, other: DateTime) Duration {
430 return Duration{430 return Duration{
431 .ms = self.toUnixMilli() - other_in_the_past.toUnixMilli(),431 .ms = @as(i64, @intCast(self.toUnixMilli())) - @as(i64, @intCast(other.toUnixMilli())),
432 };432 };
433 }433 }
434434
...@@ -548,7 +548,7 @@ fn toTuple(array: anytype) @Tuple(&@as([array.len]type, @splat(std.meta.Child(@T...@@ -548,7 +548,7 @@ fn toTuple(array: anytype) @Tuple(&@as([array.len]type, @splat(std.meta.Child(@T
548}548}
549549
550pub const Duration = struct {550pub const Duration = struct {
551 ms: u64,551 ms: i64,
552};552};
553553
554// Divisions of a nanosecond.554// Divisions of a nanosecond.