 }
 
 void loop()
-{ 
+{
+  unsigned long milliseconds = millis();
   bool setHourPressed = !digitalRead(SET_HOUR),
        setMinutePressed = !digitalRead(SET_MINUTE);
   
   if (setHourPressed && !hourIncremented)
   {
-    addMillis(hourDivisor);
+    offsetMillis(hourDivisor);
     hourIncremented = true;
   }
   else if (setMinutePressed && !minuteIncremented)
   {
-    addMillis(minuteDivisor - millis() % minuteDivisor);
+    offsetMillis(minuteDivisor - milliseconds % minuteDivisor);
     minuteIncremented = true;
   }
   else if (!setHourPressed && hourIncremented)

  {
    minuteIncremented = false;
  }

  if (millis() >= millisMax)
  {
    addMillis(-millisMax);
  }
  
  unsigned short hour = millis() / hourDivisor % 12,
                 minute = millis() / minuteDivisor % 60,
                 second = millis() / secondDivisor % 60;
  
  if (millis() < 10 * secondDivisor)
  {
    hour = minute = second = second * 11;
  }
  else if (hour == 0)
  {

#define BLANKING_US 200

extern volatile unsigned long timer0_millis;
const unsigned long maxMilliseconds = (unsigned long)12 * 60 * 60 * 1000,
                    secondDivisor = 1000,
                    minuteDivisor = secondDivisor * 60,
                    hourDivisor = minuteDivisor * 60;
bool hourIncremented = false,
     minuteIncremented = false;

void offsetMillis(unsigned long offset)
{
  uint8_t oldSREG = SREG;
  
