From cf2673d4d4bc8d6b96f4488847d8c2b3c3545010 Mon Sep 17 00:00:00 2001 From: Botahamec Date: Mon, 21 Mar 2022 22:00:30 -0400 Subject: Add seconds or nanoseconds to DateTime --- src/timezone.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/timezone.rs') diff --git a/src/timezone.rs b/src/timezone.rs index f0096c6..eb539fb 100644 --- a/src/timezone.rs +++ b/src/timezone.rs @@ -5,7 +5,7 @@ use core::fmt::Display; /// A type that can be used to represent a `TimeZone` pub trait TimeZone: Sized + Eq + Display { /// The error to return in case of a failure to convert the local time to UTC - type Err; + type Err: core::fmt::Debug; /// Given the time in the UTC timezone, determine the `UtcOffset` fn utc_offset(&self, date_time: DateTime) -> UtcOffset; @@ -16,7 +16,7 @@ pub trait TimeZone: Sized + Eq + Display { /// /// This returns an Err if the given `NaiveDateTime` cannot exist in this timezone. /// For example, the time may have been skipped because of daylight savings time. - fn offset_from_local_time(&self, date_time: NaiveDateTime) -> Result; + fn offset_from_local_naive(&self, date_time: NaiveDateTime) -> Result; } #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] @@ -30,7 +30,7 @@ impl TimeZone for Utc { UtcOffset::UTC } - fn offset_from_local_time(&self, _: NaiveDateTime) -> Result { + fn offset_from_local_naive(&self, _: NaiveDateTime) -> Result { Ok(UtcOffset::UTC) } } @@ -121,7 +121,7 @@ impl TimeZone for UtcOffset { *self } - fn offset_from_local_time(&self, _: NaiveDateTime) -> Result { + fn offset_from_local_naive(&self, _: NaiveDateTime) -> Result { Ok(*self) } } -- cgit v1.2.3