Reset millis() clock

albert,
I wouldn't throw hardware at a s/w issue.
I think you would be better of using the Time and TimeAlarms libraries.
They do it all for you and don't have any millis() rollover issues.
Time library tracks time and allows for a synchronization routine to set the time and keep the time in sync.
It also allows setting a sync interval for how often to re-sync the time.
The TimeAlarms library provides for setting up "alarms" that can call your functions
at predetermined date/times or periodically.

There are many examples provided including one that uses NTP to sync the time.

Although if you really want to slam the millis() clock back to zero:

/*
 * Code to Reset the millis counter back to 0
 * NOTE: this does not reset the hardware counter and
 * also does not set the software fractional value as that was declared static
 * in wiring.c
 * As a result, the first "tick" will be be shorter than it should be.
 */

void millisReset()
{
extern volatile	unsigned long timer0_millis;
extern volatile	unsigned long timer0_overflow_count;
	noInterrupts();
	timer0_millis = 0;
	timer0_overflow_count = 0;
	interrupts();
}

--- bill

albertk836:
The documentation states the mills() will reset about every 50 days. I am assuming at or about 50 days the value will go to Zero and start over. This may have some unpredictable result on my system. To be proactive, I was thinking about a day counter that when it gets to 40 days and 40 nights :astonished:, to cause a pin on the arduino to toggle and fire a 555 to make a reset pulse.

40 days and 40 nights, eh? And then the sprinkler goes haywire and causes a flood?

There is no need to reset the timer, any more than you have to reset your clock at midnight. By doing subtraction on unsigned longs the rollover is handled seamlessly. Please post the code in question that you think may have problems.