Page 1 of 1

Millis function

Posted: Fri Jul 09, 2021 4:16 pm
by Fernando Perez
I am using the millis function and I have a question.
"Returns the number of milliseconds passed from the start-up of the module"
Where is this value stored? What is its limit? That is, is it reset to zero after 1 day, when reaching a limit value or how?
Thanks.

Re: Millis function

Posted: Sat Jul 10, 2021 5:42 am
by PeterN
Hi Fernando
I guess that the rules of the Arduino environment apply here ...
----------
millis()
[Time]
Description
Returns the number of milliseconds passed since the Arduino board began running the current program. This number will overflow (go back to zero), after approximately 50 days.
...
Returns
Number of milliseconds passed since the program started. Data type: unsigned long.

-----------
The 32bit unsigned value then ends up in ANNEX in a 32bit integer variable, so it should still reflect the mentioned 50 days and then starts again at 0

Re: Millis function

Posted: Sat Jul 10, 2021 7:13 am
by cicciocb
Hi,
yes I confirm what said by PeterN.

Re: Millis function

Posted: Sat Jul 10, 2021 9:27 am
by Fernando Perez
Thank you both very much. If so, I can use it without problems in the project in which I work that will use periods of 31 days maximum.

Re: Millis function

Posted: Sun Jul 11, 2021 8:04 am
by its1000
thank you for this info too. i was looking for it.