Repository navigation
system: Fix Custom RTC Date offset calculation and UI feedback loop - #808
Open
Amnesia1000 wants to merge 1 commit into
Open
Amnesia1000 wants to merge 1 commit into
Amnesia1000 wants to merge 1 commit into
Conversation
Fixes an issue where setting a custom RTC date either failed to apply or reverted to the current system time: - Clamp custom_rtc_offset bounds to 32-bit int limits so QSpinBox does not overflow and lock its valid range to [0, 0]. - Compute the RTC offset relative to current epoch time on edit and use QSignalBlocker to break the recursive signal loop between the date picker and spinbox. - Handle signed offsets safely in core to avoid integer underflow on past dates. Fixes Eglantine-Community#471 Assisted-by: Antigravity (code analysis and review)
|
Retargeted to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes an issue where configuring a Custom RTC Date in the UI either failed to apply or continuously reset to the current system date/time.
Root causes addressed:
Settings::values.custom_rtc_offsethad 64-bit limits (numeric_limits<s64>::min()/max()), which overflowed when passed to the 32-bit QtQSpinBoxand caused Qt to clamp its valid range to[0, 0]. Bounds are now bounded byintlimits.QDateTimeEdit::dateTimeChangedandQSpinBox::valueChanged, where editing the date triggered a reset back to the current time.QSignalBlockeris now used to break this loop, and the offset is computed directly from current epoch time.Core::System::Impl::Run,time_offsetandcurrent_timewereu64, causing an underflow and overflow into future centuries when setting a date prior to the current date. They are now signeds64with a floor of 0.QSpinBoxfrom the configuration UI since users only need the date picker.Type of change
Related issues
Fixes #471
Testing
Checklist
AI Disclosure
Assisted-by: Antigravity (code analysis and review)