Skip to content

core/clock: preserve DST occurrence when rounding ticks - #1385

Draft
nikooo777 wants to merge 1 commit into
quickshell-mirror:masterfrom
nikooo777:fix/system-clock-dst
Draft

nikooo777 wants to merge 1 commit into
quickshell-mirror:masterfrom
nikooo777:fix/system-clock-dst

Conversation

@nikooo777

Copy link
Copy Markdown

Fixes #329.

AI-generated implementation and validation notes

During DST fall-back, QDateTime::setTime() can resolve a rounded local time to the first occurrence of the repeated hour. In the second occurrence, SystemClock.date then moves backwards and the next timer deadline lands in the past. Qt clamps the negative interval to 1 ms, causing rapid clock updates and warning spam.

Round the published time and next deadline with elapsed-time arithmetic, preserving the current occurrence of the repeated hour. Retain Qt's existing wall-time resolution across partial-hour transitions. The minimum Qt version remains 6.6.

Add an isolated Linux clock test covering both fall-back occurrences, spring-forward, seconds/minutes/hours precision, half-hour and quarter-hour offsets, Lord Howe's 30-minute DST transition, and an early tick across fall-back. The test substitutes wall time without changing the machine's clock or Qt's monotonic timers.

Validation:

  • All 39 clock checks pass on Qt 6.6.0 and Qt 6.12. On Qt 6.12, the same tests with upstream clock.cpp report 32 passed and 7 failed.
  • Full Ninja build passes with Qt 6.12. The full suite passes 9 of 10 executables; popupwindow::moveWithParent fails identically with upstream clock.cpp and test build configuration under the offscreen platform.
  • Formatting and standard clang-tidy checks pass for the new tests and changed production lines. The custom tidyfox plugin was unavailable locally.

@txemaleon

Copy link
Copy Markdown

Quickshell clock clogs loggs until screenshotting restarts hyprland

AI-generated diagnostic evidence

The warning loop produced 13.4 million messages and filled the runtime filesystem. A subsequent screenshot caused hyprpicker SIGBUS, followed one second later by Hyprland SIGBUS. Independent testing of this PR passes all 39 clock checks.

rdoupe added a commit to omarchy-asus/omarchy-asus that referenced this pull request Nov 1, 2026
…n the DST fall-back hour (#386)

When local time steps back an hour (02:00 EDT -> 01:00 EST, 03:00 CEST ->
02:00 CET), SystemClock rounds the current time with QDateTime::setTime(),
which resolves the repeated hour to its first occurrence. The clock shows the
summer-time hour, the next tick is an hour in the past, Qt clamps it to 1 ms
and the shell logs "QTimer::start: negative intervals" about a thousand times
a second for the whole hour, filling $XDG_RUNTIME_DIR with its log
(omacom/omarchy#16677, quickshell-mirror/quickshell#329).

New recipe: Omarchy's quickshell packaging at the release the rc channel
serves, plus quickshell-mirror/quickshell#1385's commit (a draft by another
contributor), taken as is less its changelog line. It rounds with elapsed-time
arithmetic, so the current occurrence is kept.

tests/channel/quickshell-dst-fall-back.sh runs qs headless with only its wall
clock moved into the New York and Berlin repeated hours and across the fold:
stock storms (6-8 thousand warnings in 4-5 s, summer-time offset), the patched
build has none, ticks once a second and shows winter time.

Co-authored-by: rdoupe <1207041+rdoupe@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

SystemClock breaks across Daylight Saving Time transitions

2 participants