Millis function

If doesn't fit into any other category ....
Post Reply
User avatar
Fernando Perez
Posts: 106
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 55 times
Been thanked: 54 times

Millis function

Post 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.
User avatar
PeterN
Posts: 97
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 41 times
Been thanked: 45 times
Contact:

Re: Millis function

Post 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
cicciocb
Site Admin
Posts: 309
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 85 times
Been thanked: 197 times
Contact:

Re: Millis function

Post by cicciocb »

Hi,
yes I confirm what said by PeterN.
User avatar
Fernando Perez
Posts: 106
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 55 times
Been thanked: 54 times

Re: Millis function

Post 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.
its1000
Posts: 55
Joined: Thu May 20, 2021 6:57 pm
Has thanked: 1 time
Been thanked: 1 time

Re: Millis function

Post by its1000 »

thank you for this info too. i was looking for it.
Post Reply