core/clock: fix breakage at midnight

The difference between 23:59 and 00:00 is -23:59, not 00:01.
This commit is contained in:
outfoxxed committed 2024-07-31 01:51:53 -07:00
1 parent 76744c903a
commit a4903eaefc
1 file changed
+5 -1
+5 -1
View File
@@ -55,7 +55,11 @@ void SystemClock::update() {
else if (minutePrecision) nextTime = nextTime.addSecs(60);
else if (hourPrecision) nextTime = nextTime.addSecs(3600);
this->timer.start(time.msecsTo(nextTime));
auto delay = time.msecsTo(nextTime);
// day rollover
if (delay < 0) delay += 86400000;
this->timer.start(delay);
} else {
this->timer.stop();
}