Arduino Time Library - limitations?

Hello!

I'm writing a program that uses the Time library found in the playground.

I've heard that there might be a 6-7 day maximum in which I can count time, is this true?

Basically, I need to set something to go off every 6 hours from program start. The arduino doesn't need to know what external time it is, I just need to activate a relay once every 6 hours. Will this work or do you guys think I'll run into limitations using this library?

I'm setting it up to test right now, but won't know results for at least another week...

For reference, the Time library can be found here:

http://www.arduino.cc/playground/Code/Time

I've heard that there might be a 6-7 day maximum in which I can count time, is this true?

From the code of the library, there should be no problem as long as you call now() or any of the functions returning a time at least once every 49 days.

The main concern would be how much drift you get when relying only on the internal timer without external time synchronisation to keep the current date. If you're just interested in intervals of 6 hours, a few seconds difference shouldn't be a big problem.

On the other hand, if you just need intervals of 6 hours, you don't need the library, you could simply use the function millis() instead. Internally the library uses it too.

Something like:

loop () {
...
static unsigned long lastevent;
if (millis() - lastevent >= 6*3600000) {
    lastevent = millis();
    // Do the thing you want to do every 6 hours
   ...
}

Korman

Thank you VERY much for the informative answer, it is much appreciated!