     if (t1.second() == t2.second()) {
         doFlash(ledPort, 1 + 2, 8);
     }
+
+    // Initialize millisRTC for time check task
+    millisRTC.begin(t2);
+    cur_mRTC_cycle = mRTC_refresh_cycle; 
     
 #ifdef DEBUG_TRACE
     // Dump wps array

// Uncomment for LEDs flashing for debug
#define DEBUG_FLASH
// Uncomment for debug traces on the serial line
#define DEBUG_TRACE 

#include <JeeLib.h>
#include <Wire.h> // needed to avoid a linker error :(


        // Check if awake or asleep
        case CHK_TIME:
            // Reset millis()-based RTC from real one if the time
            // cycles have elapsed
            if (--cur_mRTC_cycle < 0) {
#ifdef DEBUG_TRACE
                DateTime t_mrtc = millisRTC.now();
                Serial.print("mRTC time: ");
                Serial.print(t_mrtc.year());
                Serial.print('-');
                Serial.print(t_mrtc.month());
                Serial.print('-');
                Serial.print(t_mrtc.day());
                Serial.print(' ');
                Serial.print(t_mrtc.hour());
                Serial.print(':');
                Serial.print(t_mrtc.minute());
                Serial.print(':');
                Serial.println(t_mrtc.second());
                Serial.flush();
                DateTime t_rtc = RTC.now();
                Serial.print("RTC time: ");
                Serial.print(t_rtc.year());
                Serial.print('-');
                Serial.print(t_rtc.month());
                Serial.print('-');
                Serial.print(t_rtc.day());
                Serial.print(' ');
                Serial.print(t_rtc.hour());
                Serial.print(':');
                Serial.print(t_rtc.minute());
                Serial.print(':');
                Serial.println(t_rtc.second());
                Serial.flush();
#endif
                millisRTC.adjust(RTC.now());
                cur_mRTC_cycle = mRTC_refresh_cycle; 
#ifdef DEBUG_TRACE
                Serial.println("mRTC refreshed");
                Serial.flush();
#endif
            } 

            // Get time
            DateTime now = millisRTC.now();

            // Check every check_cycle seconds
            word sec_til_check = check_cycle - (now.get() % check_cycle);
            // Never check sooner than 2 seconds. A perhaps futile attempt
            // to prevent RTC clock from being interrogated too often
            if (sec_til_check < 2) sec_til_check = 2;
            // TODO if sec_til_check is shorter than the check cycle by
            // more than a couple seconds, then reschedule and break so
            // the lights start their cycle with the CHK_TIME cycle.
            scheduler.timer(CHK_TIME, sec_til_check * 10);

#ifdef DEBUG_TRACE
            Serial.print("mRTC time: ");
            Serial.print(now.year());
            Serial.print('-');
            Serial.print(now.month());
