summaryrefslogtreecommitdiff
path: root/src/time.rs
diff options
context:
space:
mode:
authorBotahamec <botahamec@outlook.com>2022-03-18 14:57:13 -0400
committerBotahamec <botahamec@outlook.com>2022-03-18 14:57:13 -0400
commitdb9f20681f90f206d393d2b06a6a8401515ff562 (patch)
tree48c16c94a4bf0da27c7cde56a247703b7794600c /src/time.rs
parente0e0a18a4bc873583e973d771669e88a92b20d92 (diff)
Addition methods for NaiveDateTime
Diffstat (limited to 'src/time.rs')
-rw-r--r--src/time.rs8
1 files changed, 4 insertions, 4 deletions
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