Show Posts
Pages: [1]
1  Using Arduino / Programming Questions / Time and TimeAlarms Libraries – Overflow of millis() on: January 27, 2013, 01:34:39 pm
Hey all,

I have a question regarding the function time_t now() inside the time library:
Inside this function the Arduino built-in timer ( millis() ) is compared to a last update time of the library.
I wonder what will happen after approx. 50 days of operation when the number returned by millis() has an overflow.

As far as I understood the code, the time will stay at its last update time and will not run anymore.
Did anyone observe such a behaviour or is there a certain function which takes care about such an overflow which I did not recognize?


time_t now(){
  while( millis() - prevMillis >= 1000){     
    prevMillis += 1000;
    sysUnsyncedTime++; // this can be compared to the synced time to measure long term drift     


  return sysTime;
Pages: [1]