https://bugs.kde.org/show_bug.cgi?id=511293

Vlad Zahorodnii <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|https://invent.kde.org/plas |https://invent.kde.org/plas
                   |ma/knighttime/-/commit/ce36 |ma/knighttime/-/commit/d906
                   |931b53817c761540d099646b71c |175dbf792b4a363b059c00bfe76
                   |6458300d7                   |77dd28517

--- Comment #3 from Vlad Zahorodnii <[email protected]> ---
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 <[email protected]>

M  +39   -16   autotests/schedule_test.cpp
M  +11   -1    src/kdarklightschedule.cpp

https://invent.kde.org/plasma/knighttime/-/commit/d906175dbf792b4a363b059c00bfe7677dd28517

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to