Unified · Split
| @@ -42,7 +42,7 @@ impl Time { · 41 unmodified lines | |||
| 42 | 42 | ||
| 43 | fn format_inner(&self, format: Format) -> String { | 43 | fn format_inner(&self, format: Format) -> String { |
| 44 | match format { | 44 | match format { |
| 45 | Format::Custom(CustomFormat(format)) => self.to_time().strftime(format).to_string(), | 45 | Format::Custom(CustomFormat(format)) => self.to_zoned().strftime(format).to_string(), |
| 46 | Format::Unix => self.seconds.to_string(), | 46 | Format::Unix => self.seconds.to_string(), |
| 47 | Format::Raw => self.to_string(), | 47 | Format::Raw => self.to_string(), |
| 48 | } | 48 | } |
| @@ -50,7 +50,8 @@ impl Time { · 1 unmodified line | |||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | impl Time { | 52 | impl Time { |
| 53 | fn to_time(self) -> jiff::Zoned { | 53 | /// Produce a `Zoned` time for complex time computations and limitless formatting. |
| 54 | pub fn to_zoned(self) -> jiff::Zoned { | ||
| 54 | let offset = jiff::tz::Offset::from_seconds(self.offset).expect("valid offset"); | 55 | let offset = jiff::tz::Offset::from_seconds(self.offset).expect("valid offset"); |
| 55 | jiff::Timestamp::from_second(self.seconds) | 56 | jiff::Timestamp::from_second(self.seconds) |
| 56 | .expect("always valid unix time") | 57 | .expect("always valid unix time") |