Fix potential timezone inaccuracy

For non whole-hour timezones, the previous logic would not produce
correct timestamps.
This commit is contained in:
Rahix 2026-03-05 22:00:02 +01:00
parent af6fbb0022
commit 0d59568c9e

View file

@ -1,5 +1,7 @@
pub fn time_to_jiff(t: time::OffsetDateTime) -> jiff::Zoned {
let tz = jiff::tz::TimeZone::fixed(jiff::tz::offset(t.offset().whole_hours()));
let tz = jiff::tz::TimeZone::fixed(
jiff::tz::Offset::from_seconds(t.offset().whole_seconds()).unwrap(),
);
jiff::Timestamp::new(t.unix_timestamp(), 0)
.unwrap()