From 2a7a0794b73be9205e9bcbb602276de22f7be7d7 Mon Sep 17 00:00:00 2001 From: Jacob Pratt Date: Tue, 8 Oct 2024 04:06:28 -0400 Subject: [PATCH] Add `Time::MAX` --- time/src/time.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/time/src/time.rs b/time/src/time.rs index 2bd2fefe8..24ba2011a 100644 --- a/time/src/time.rs +++ b/time/src/time.rs @@ -143,25 +143,26 @@ impl Time { ]); } - /// Create a `Time` that is exactly midnight. + /// A `Time` that is exactly midnight. This is the smallest possible value for a `Time`. /// /// ```rust /// # use time::Time; /// # use time_macros::time; /// assert_eq!(Time::MIDNIGHT, time!(0:00)); /// ``` - pub const MIDNIGHT: Self = Self::MIN; - - /// The smallest value that can be represented by `Time`. - /// - /// `00:00:00.0` - pub(crate) const MIN: Self = + #[doc(alias = "MIN")] + pub const MIDNIGHT: Self = Self::from_hms_nanos_ranged(Hours::MIN, Minutes::MIN, Seconds::MIN, Nanoseconds::MIN); - /// The largest value that can be represented by `Time`. + /// A `Time` that is one nanosecond before midnight. This is the largest possible value for a + /// `Time`. /// - /// `23:59:59.999_999_999` - pub(crate) const MAX: Self = + /// ```rust + /// # use time::Time; + /// # use time_macros::time; + /// assert_eq!(Time::MAX, time!(23:59:59.999_999_999)); + /// ``` + pub const MAX: Self = Self::from_hms_nanos_ranged(Hours::MAX, Minutes::MAX, Seconds::MAX, Nanoseconds::MAX); // region: constructors