From db9f20681f90f206d393d2b06a6a8401515ff562 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Fri, 18 Mar 2022 14:57:13 -0400 Subject: Addition methods for NaiveDateTime --- src/time.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/time.rs') diff --git a/src/time.rs b/src/time.rs index 3777c1a..fcb6434 100644 --- a/src/time.rs +++ b/src/time.rs @@ -365,10 +365,10 @@ impl Time { /// Gets the number of seconds since midnight #[must_use] - pub fn seconds_from_midnight(self) -> u32 { - u32::from(self.hour) * 3_600_000_000 - + u32::from(self.minute) * 60_000_000 - + u32::from(self.second) * 1_000_000 + pub const fn seconds_from_midnight(self) -> u32 { + self.hour as u32 * 3_600_000_000 + + self.minute as u32 * 60_000_000 + + self.second as u32 * 1_000_000 } /// Gets the number of nanoseconds since midnight -- cgit v1.2.3