From f9a433b782d15b6526af2faf3e222eb4efe7f6cd Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Thu, 21 Oct 2021 20:35:44 -0700 Subject: [PATCH] add eql(DateTime, DateTime) bool --- time.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/time.zig b/time.zig index 7509a48917b06a57c5ec1e25aaa788b7bc1b4a53..30ac036a5f57c4b8b46eb2b52c2b5251c53eceaa 100644 --- a/time.zig +++ b/time.zig @@ -46,6 +46,18 @@ pub const DateTime = struct { .weekday = .Thu, }; + pub fn eql(self: Self, other: Self) bool { + return self.ms == other.ms and + self.seconds == other.seconds and + self.minutes == other.minutes and + self.hours == other.hours and + self.days == other.days and + self.months == other.months and + self.years == other.years and + self.timezone == other.timezone and + self.weekday == other.weekday; + } + pub fn addMs(self: Self, count: u64) Self { if (count == 0) return self; var result = self; -- 2.54.0