amazed:
I've built a module with a standalone Atmega328p and the clock source is an external crystal. I've measured 1 sec drift in 12 hours. So I could make it more accurate if I add 83ms to the timer0_millis every hour.
Rather than fiddle with the Arduino code for millis() why not use it (or micros() ) to update your own millisCounter and adjust that with your correction factor. Something like
if (micros() - previousMicros >= 1000) (
myMillisCounter ++;
previousMicros += 1000;
}
if (myMillisCounter - myPreviousMillisValue >= (60 * 60 * 1000UL)) {
myMillisCounter += 83;
myPreviousMillisValue = myMillisCounter;
}
...R