Hi,
If someone is using time.cpp on Arduino Mega 2560 and concerns about board running longer than 49 days without restart, then
function now() first chunk "
while( millis() - prevMillis >= 1000){
sysTime++;
prevMillis += 1000;
"
needs to be replaced with this chunk "
unsigned long currtime = millis();
if (currtime > prevMillis) // if timer has not run over max value
{
if (currtime - prevMillis >= 1000) // if the second has passed
{
sysTime++;
prevMillis = currtime;
}
}
else // if timer has rolled over
{
if ((0xFFFFFFFF - prevMillis + currtime) >= 1000)
{
sysTime++;
prevMillis = currtime;
}
}
"