diff options
| author | Botahamec <botahamec@outlook.com> | 2022-03-21 22:00:30 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2022-03-21 22:00:30 -0400 |
| commit | cf2673d4d4bc8d6b96f4488847d8c2b3c3545010 (patch) | |
| tree | e9777ca24e0f2deda276e4d488e06a5ebeddb5fa /src/timezone.rs | |
| parent | 54d431b34edcc702ac88ec7d88d42487c12b17b4 (diff) | |
Add seconds or nanoseconds to DateTime
Diffstat (limited to 'src/timezone.rs')
| -rw-r--r-- | src/timezone.rs | 8 |
1 files changed, 4 insertions, 4 deletions
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<Utc>) -> 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<UtcOffset, Self::Err>; + fn offset_from_local_naive(&self, date_time: NaiveDateTime) -> Result<UtcOffset, Self::Err>; } #[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<UtcOffset, Self::Err> { + fn offset_from_local_naive(&self, _: NaiveDateTime) -> Result<UtcOffset, Self::Err> { Ok(UtcOffset::UTC) } } @@ -121,7 +121,7 @@ impl TimeZone for UtcOffset { *self } - fn offset_from_local_time(&self, _: NaiveDateTime) -> Result<UtcOffset, Self::Err> { + fn offset_from_local_naive(&self, _: NaiveDateTime) -> Result<UtcOffset, Self::Err> { Ok(*self) } } |
