Arduino Timer0 Piggyback
The Arduino core configures Timer 0 for a period of 1,024&nbsp;µs. Your
ISR will then be called at very regular intervals, and is a good place
to have timing-related code. You just have to keep in mind that the unit
of time is not one millisecond, but 1.024&nbsp;ms.

If this “weird” unit bothers you, then you could do what the Arduino
timing ISR does: keep track of how late, relative to a 1&nbsp;ms
period, you are getting. When you notice you are 1&nbsp;ms late, count
one extra millisecond.