Does the millus funtion counter go back to zero when ardunio is shut down?

Sorry I could not find the answer anywhere.

I am using Ardunio for projects on a Model Railroad. The railroad will only run a few hours per day and the layout and the Ardunio are then shut down. There has been a lot a talk about overflow on the Millus counter.

When I shut down the Ardunio will the counter go back to zero or will the next time I start the layout the counter will start where it left off?

The millis function returns the number of milliseconds since the last reset.

More here

The millis() function returns an 'unsigned long' (a.k.a. 'uint32_t') which can hold about 4.2 billion milliseconds. You have to run continuously for over 49.7 days to see it roll over to zero.

If you accidentally store the value in an 'unsigned int' (uint16_t) it will roll over to zero after 65535 milliseconds: just over 65 seconds. Even worse if you use a signed integer. It rolls over from 32767 to -1 after 32.7 seconds and then counts down from there.

haroldwolf:
When I shut down the Ardunio will the counter go back to zero or will the next time I start the layout the counter will start where it left off?

The millis() counter is only resident in RAM. If you power down the Arduino, the memory will not persist and when power is restored, it will have to start from zero.