The reference guide states that the millis() function can run for about 9 hours before rolling-over to zero.

I was wondering what the exact value is that it rolls-over after? If I knew this then I could still work out the elapsed time after it had rolled-over ... assuming I'd checked it before it rolled over the first time. By keeping a count of the number of roll-overs I could have my own VERY long elapsed time function.

This got me to thinking about the roll-over value/time and I am now not sure how the 9 hours is calculated. The reference guide tells me that millis() provides a value of data type unsigned long. Then it tells me that an unsigned long (32 bits) ranges from 0 to 4,294,967,295 (2^32 - 1). By my calculation this should roll-over after 1193 hours (~50 days), assuming the full 32 bits are used.

4,294,967,295 / 1000 = 4,294,967 seconds

4,294,967 /60 = 71582 minutes

71582 / 60 = 1193 hours

This is a long way from 9 hours .... can someone clarify this for me please?

Secondly, is it possible to clear, or reset the millis() counter back to zero via software?

Thanks in advance ... Matt