Closed tmpfs closed 1 year ago
This is definitely a bug. I would've sworn I fixed this before, but apparently not. I'll get a patch pushed up soon for this, but it won't be released until November 19 at the earliest. This is because there is an MSRV bump on main that cannot be released before then.
Hmm…this is actually a bit trickier than I anticipated. Basically, the values are assigned directly into the Parsed
struct, which is then converted into final type. As a result of the way things are parsed, the sign is always attached to the offset hour. One problem: Parsed::set_hour
, which is currently used internally, accepts the hour. This naturally means that negative zero is semantically lost.
What I'm attempting is to have an additional flags that's set when negative zero hours is encountered, thus indicating that the value is negative. It's a bit of a hack, but short of forcing ones' complement, that's the best I can do. The flag will be wholly internal, such that it's not possible for a user to directly access it.
Fixed on main.
Hmm…this is actually a bit trickier than I anticipated. Basically, the values are assigned directly into the
Parsed
struct, which is then converted into final type. As a result of the way things are parsed, the sign is always attached to the offset hour. One problem:Parsed::set_hour
, which is currently used internally, accepts the hour. This naturally means that negative zero is semantically lost.What I'm attempting is to have an additional flags that's set when negative zero hours is encountered, thus indicating that the value is negative. It's a bit of a hack, but short of forcing ones' complement, that's the best I can do. The flag will be wholly internal, such that it's not possible for a user to directly access it.
Thanks for the clear explanation and quick fix. Can we expect a patch release to be published on or after the 19th? I would prefer to avoid depending on main
in the meantime if a published version is not too far away.
Yes, plan on a release on or within a couple days after the 19th.
Apologies for the ping @jhpratt , just wondering when this fix might be published? Thanks 🙏
Soon. Main is not currently in a state suitable for release. Given the holiday in the US, I've been quite busy this week. I haven't even been on my laptop in a couple days.
Ok thanks @jhpratt, enjoy the holiday, will check back in a week or two 🙌
Happy new year @jhpratt , I noticed you bumped the MSRV, could I please get a release that includes this fix?
I need to document other changes that have been made on main before creating a release. That's the blocker.
Hi,
I may be misunderstanding how negative offsets work when the hours are zero but I just found an unexpected positive offset with this code:
I was expecting a negative
UtcOffset
57 minutes to the West, is this a bug?