Millis function

If doesn't fit into any other category ....
Post Reply
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 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: 366
Joined: Mon Feb 08, 2021 7:56 pm
Location: Krefeld, Germany
Has thanked: 171 times
Been thanked: 203 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
User avatar
cicciocb
Site Admin
Posts: 1899
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: Millis function

Post by cicciocb »

Hi,
yes I confirm what said by PeterN.
User avatar
Fernando Perez
Posts: 378
Joined: Mon Feb 15, 2021 10:09 pm
Location: Santander (Spain)
Has thanked: 195 times
Been thanked: 267 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: 76
Joined: Thu May 20, 2021 6:57 pm
Has thanked: 3 times
Been thanked: 1 time

Re: Millis function

Post by its1000 »

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