Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unsigned to signed conversion bug #656

Merged
merged 1 commit into from
Feb 3, 2024
Merged

Conversation

GregoryLakewood
Copy link
Contributor

Casting u32 into i32 and then extending into i64 does not hold the value when val_u32 > i32::MAX.
As explained in Microsoft Documentation one should firstly construct u64 from FILETIME and then perform arithmetics.

@jhpratt
Copy link
Member

jhpratt commented Feb 3, 2024

LGTM. As this won't affect (non-artificial) timestamps for 14 years, I won't be cutting a release specifically for this.

@jhpratt jhpratt merged commit ef7bfbd into time-rs:main Feb 3, 2024
19 of 20 checks passed
@jhpratt jhpratt added C-bug Category: bug in current code A-local-offset Area: local offset labels Feb 3, 2024
@GregoryLakewood
Copy link
Contributor Author

Thank you.
@jhpratt Could you look into this? I found this bug because I am getting Err(IndeterminateOffset) on my machine.
That breaks some Rust tools I use, specifically probe-rs.
From my understanding 31bit in lower FILETIME DWORD toggles every 2^31*100 nanoseconds what equals roughly 3 and half minutes.

@jhpratt
Copy link
Member

jhpratt commented Feb 3, 2024

Ha, I wasn't thinking of the fact that it represents 100 nanosecond intervals. I was only off by a factor of ten million.

I'll be having another release later today.

@jhpratt
Copy link
Member

jhpratt commented Feb 3, 2024

Released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-local-offset Area: local offset C-bug Category: bug in current code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants