   delay(1000);
   updateTimeDisplay(t, true, alarmMasterSwitchEnabled);
   waitForButtonDepress(TimeButton, LOW);
-  unsigned long modeActive = millis();
+  uint32_t modeActive = millis();
   bool normalExit = true;
   while (debounceDigitalRead(TimeButton) == HIGH) {
     int16_t encoderDelta = encoder->getValue();
     updateTime(t, encoderDelta);
     modeActive = millis();
-    if (static_cast<unsigned long>(millis() - modeActive) > modeInactivePeriod) {
+    if (static_cast<uint32_t>(millis() - modeActive) > modeInactivePeriod) {
       normalExit = false;
       break;
     }

  alarmEnabled = true;
}

unsigned long millisAtStartOfSunSet = 0;
bool sunSetActive = false;
void setSunSet() {
  matrix.print(defaultSunSetDelta);

  }
}

const uint32_t clockUpdateInterval = 24 * 60 * 60 * 1000; // every 24 hours
uint32_t lastClockUpdate = millis();
void updateClockTime(bool force = false) {
  if (force || isTimeNow(lastClockUpdate, clockUpdateInterval)) {
    synchronized_clock_time = ClockTime(RTC.now());
