I am using millis() to perform some time-based calculations, and want to be able to reset millis automatically every 24hrs back to 0.I am using a long integrer to count millis, and was thinging along the lines of;

I would prefer a software solution, so would my original idea work?I am not worried about the overflow, but resetting millis gives me a clean sheet every day, and resets the counters linked to millis.

To the first, I think not. It may appear to, but from what I've read, interferring with certain elements such as timing will affect all sorts of other libraries that use it. So you can expect issues with anything that uses those elements.

For the second, the problem is that you'll start by asking for zero to mean "midnight", but then tomorrow you'll be trying to work out how to deal with an Arduino resetting during the day. Will you then set the clock to 355322 to change it?

If you need real time, get an RTC. If you need durations, calculate them.

"duration = end - start" is easier than fiddling with underlying low-level calls.

int i=0;for (i=0 ; i<10 ;i++ ) { ...}for ( ; i>0 ;i-- ) { ...} two for loops, the int i is declared outside the for loops so it can be reused, the first loop counts to 10 and the second loop counts back to 0.This is possible as the second for does not (re)initialize the var i.