Millis Accuracy Again

orly_andico:
I cannot get the measured rotational speed to match 86164 seconds. It varies with every run, e.g. 86300, 85950, 86000... about 1000ppm difference.

I am running SPI at 2MHz, doing a lot of serial I/O, and have a couple interrupts hooked up via the Encoder library.

It might just be hardware clock inaccuracy, but I'd have expected that to be relatively consistent for a given device under similar conditions. You have quite a lot of interrupt related activity going on there, and it may be that you're getting interrupt overflow on the timer interrupts. You could test for that by writing a sketch that does nothing but print the value of millis() before and after the sketch has been running for a long time, and compare the output with the actual real-world elapsed time. For example if you printed the value of millis() every hour and timestamp the output at a PC, then I expect that after a day you would have a pretty good idea how accurate the Arduino clock was. (You can use RealTerm to timestamp serial input and log it to a file.) If you prove the underlying hardware is acceptably accurate then you could look for ways to avoid contention between the interrupts. I don't have any specific suggestions other than to minimise your use of interrupts, but perhaps if you posted your code somebody will spot a way to improve it. I do suggest you test the hardware accuracy first, though, to avoid wasting everyone's time.