Fix potential timezone inaccuracy
For non whole-hour timezones, the previous logic would not produce correct timestamps.
This commit is contained in:
parent
af6fbb0022
commit
0d59568c9e
1 changed files with 3 additions and 1 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue