Millis overflow

why not using unsigned long long?
it is proved to be at least 64 bits or 8 bytes so it can store 2^64 -1 numbers or 18446744073709551615 miliseconds, also Arduino compiler accept it and I tried with UNO R3, it worked.
this is 584942417.35 years!!!

Why would you? millis() returns a unsigned long. Which works fine for forever as long as the interval you want to time is smaller then 49 days. Only requirement is you check it like:

if(millis() - lastMillis >= interval){
//and NOT like
if(millis() >= lastMillis + interval){

farzadlatifeh:
why not using unsigned long long?
it is proved to be at least 64 bits or 8 bytes so it can store 2^64 -1 numbers or 18446744073709551615 miliseconds, also Arduino compiler accept it and I tried with UNO R3, it worked.
this is 584942417.35 years!!!

I hope you verified that.

lol, only 7 years late to the millis() party!

In particular, @AWOL @CrossRoads this thread is solid gold for a concise explanation of millis() rollover, in particular the use of unsigned types to preserve ">" tests despite rollover (in this context and many others).

The world needs more proper, old school computer scientists to help us survive!

Many thanks!