From 401cf476a8cdf0f0fdd41190cf4e6342b3eebaf3 Mon Sep 17 00:00:00 2001 From: mertcandav Date: Thu, 28 Nov 2024 20:37:44 +0300 Subject: [PATCH] std/time: add the Before method to Time --- std/time/time.jule | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/std/time/time.jule b/std/time/time.jule index bd9a1360..644c88f0 100644 --- a/std/time/time.jule +++ b/std/time/time.jule @@ -310,6 +310,11 @@ impl Time { ret self.sec > u.sec || self.sec == u.sec && self.nsec > u.nsec } + // Reports whether the time instant is before u. + fn Before(self, u: Time): bool { + ret self.sec < u.sec || self.sec == s.sec && self.nsec < u.nsec + } + fn appendTo(self, mut b: []byte)!: []byte { b, ok := appendStrictRFC3339(self, b) if !ok {