It is not an exclusive property of millis()
. AnyAny counter with a limited number of digits eventually returns to zero. ForFor example, a 4 digit tally counter returns to zerozeros after 9999
.
Under the hood, the variable for millis()
is of type unsigned long
, which is 32 bits on the Arduino. In this case, the 32 bits (binary 0's and 1's) are similar to the digits (0 thru 9) on the tally counter.
The maximum is 11111111 11111111 11111111 11111111
. Once there, millis()
returns to zero when you add 1
. The maximum (32 "ones") is 2^32 - 1
, which equals 4294967295
in the decimal number system. The maximum value for the counter is, therefore, 4,294,967,295 milliseconds. Converted to days you get approximately 49.71 days.