| Summary: | Setting night light sunset time after midnight, but before sunrise time causes it to turn on when it shouldn't | ||
|---|---|---|---|
| Product: | [Plasma] plasmashell | Reporter: | Stian <evokeglorybottling> |
| Component: | Day/night schedule | Assignee: | Plasma Bugs List <plasma-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | nate, vlad.zahorodnii |
| Priority: | NOR | Keywords: | regression |
| Version First Reported In: | 6.5.0 | ||
| Target Milestone: | 1.0 | ||
| Platform: | Arch Linux | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/plasma/knighttime/-/commit/d906175dbf792b4a363b059c00bfe7677dd28517 | Version Fixed/Implemented In: | 6.5.2 |
| Sentry Crash Report: | |||
|
Description
Stian
2025-10-28 22:21:45 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/knighttime/-/merge_requests/13 Git commit ce36931b53817c761540d099646b71c6458300d7 by Vlad Zahorodnii. Committed on 29/10/2025 at 09:21. Pushed by vladz into branch 'master'. Fix daylight duration with flipped morning and evening times If the evening time is before the morning time, QTime::secsTo() will return a negative value. In that case, morning.secsTo(evening) is going to actualy specify the time between evening and morning. For example, witb the following times - evening: 1:00 AM - morning: 6:00 AM morning.secsTo(evening) is going to return -18000, which is not what we really expect. The issue can be addressed by applying a modulo operator. But in order to make the code slightly more readable, this change goes with an explicit "seconds in a day - time from evening to morning" formula. M +39 -16 autotests/schedule_test.cpp M +11 -1 src/kdarklightschedule.cpp https://invent.kde.org/plasma/knighttime/-/commit/ce36931b53817c761540d099646b71c6458300d7 Git commit d906175dbf792b4a363b059c00bfe7677dd28517 by Vlad Zahorodnii. Committed on 29/10/2025 at 11:06. Pushed by vladz into branch 'Plasma/6.5'. Fix daylight duration with flipped morning and evening times If the evening time is before the morning time, QTime::secsTo() will return a negative value. In that case, morning.secsTo(evening) is going to actualy specify the time between evening and morning. For example, witb the following times - evening: 1:00 AM - morning: 6:00 AM morning.secsTo(evening) is going to return -18000, which is not what we really expect. The issue can be addressed by applying a modulo operator. But in order to make the code slightly more readable, this change goes with an explicit "seconds in a day - time from evening to morning" formula. (cherry picked from commit ce36931b53817c761540d099646b71c6458300d7) Co-authored-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org> M +39 -16 autotests/schedule_test.cpp M +11 -1 src/kdarklightschedule.cpp https://invent.kde.org/plasma/knighttime/-/commit/d906175dbf792b4a363b059c00bfe7677dd28517 |