From e840617047b6e3fa81f4e90055bdbd4752ee5754 Mon Sep 17 00:00:00 2001 From: Natalie Clarius Date: Sun, 28 Aug 2022 04:29:01 +0200 Subject: [PATCH] plugins/nightcolor: fix wrong transition time update in location mode BUG: 412211 --- src/plugins/nightcolor/nightcolormanager.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/plugins/nightcolor/nightcolormanager.cpp b/src/plugins/nightcolor/nightcolormanager.cpp index e3c58bee41..110f363e27 100644 --- a/src/plugins/nightcolor/nightcolormanager.cpp +++ b/src/plugins/nightcolor/nightcolormanager.cpp @@ -548,14 +548,16 @@ void NightColorManager::updateTransitionTimings(bool force) if (!force) { // first try by only switching the timings - if (daylight()) { - // next is morning - m_prev = m_next; - m_next = getSunTimings(todayNow.addDays(1), lat, lng, true); - } else { + if (m_prev.first.date() == m_next.first.date()) { // next is evening + m_daylight = true; m_prev = m_next; m_next = getSunTimings(todayNow, lat, lng, false); + } else { + // next is morning + m_daylight = false; + m_prev = m_next; + m_next = getSunTimings(todayNow.addDays(1), lat, lng, true); } }