plugins/nightlight: Guard against invalid timings in the config
Morning and evening timings should be ordered correctly. When computing the daylight duration, that ternary operator should not be needed and it hides other bugs.
This commit is contained in:
parent
07f266e7c7
commit
786b3ffbae
1 changed files with 5 additions and 1 deletions
|
@ -279,8 +279,12 @@ void NightLightManager::readConfig()
|
|||
// fixed timings
|
||||
QTime mrB = QTime::fromString(s->morningBeginFixed(), "hhmm");
|
||||
QTime evB = QTime::fromString(s->eveningBeginFixed(), "hhmm");
|
||||
if (mrB >= evB) {
|
||||
mrB = QTime(6, 0);
|
||||
evB = QTime(18, 0);
|
||||
}
|
||||
|
||||
int diffME = evB > mrB ? mrB.msecsTo(evB) : evB.msecsTo(mrB);
|
||||
int diffME = mrB.msecsTo(evB);
|
||||
int diffMin = std::min(diffME, MSC_DAY - diffME);
|
||||
|
||||
int trTime = s->transitionTime() * 1000 * 60;
|
||||
|
|
Loading…
Reference in a new issue