Skip to content

Fix getChangeDateTime() function#279

Open
zspz wants to merge 1 commit intoArturo-1212:mainfrom
zspz:fix-change-date
Open

Fix getChangeDateTime() function#279
zspz wants to merge 1 commit intoArturo-1212:mainfrom
zspz:fix-change-date

Conversation

@zspz
Copy link
Contributor

@zspz zspz commented Apr 4, 2025

Since the values stored in Bias and ActiveTimeBias are unsigned 32-bit integers, and the code expects a negative integer when the UTC offset is positive, the calculation is incorrect because it doesn't convert the unsigned integer to the correct minutes offset. The code should handle this by checking if the MSB is 1 and using ~(offset) + 1 in that case. The attached image shows what happens in the UK, which is currently UTC+1. The same problem happens for all UTC+n countries, making this issue widespread for users in Europe and Asia.

Also simplified the detection of date change crossover using %A_NowUTC% so it is standardised for all users. changeDate variable remains in the code only because it's used in the status message, can be removed to further simplify.

image
image

Since the values stored in `Bias` and `ActiveTimeBias` are unsigned 32-bit integers, and the code expects a negative integer when the UTC offset is positive, the calculation is incorrect because it doesn't convert the unsigned integer to the correct minutes offset. The code should handle this by checking if the MSB is 1 and using `~(offset) + 1` in that case.
The attached image shows what happens in the UK, which is currently UTC+1. The same problem happens for all UTC+n countries, making this issue widespread for users in Europe and Asia.

Also simplified the detection of date change crossover using `%A_NowUTC%` so it is standardised for all users. `changeDate` variable remains in the code only because it's used in the status message, can be removed to further simplify.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants