You might try this code. I have found my crystal equipped duemilanova tracks the time really well.

http://www.time.gov/timezone.cgi?Eastern/d/-5/java

Download this, with the time set a minute or so ahead, then open the serial monitor when the time is about 2-3 seconds ahead of where you set it.

For example, I set mine for 9:26, uploaded to the board, and at 9:25:57 I opened the serial monitor, which reset the board with a time at 9:26.

When I have run this in the past I did not see it drifting at all.

// time display test

unsigned long currentmicros = 0;

unsigned long previousmicros = 0;

unsigned long interval = 10000;

byte tens_hours = 0; // enter the time here, add in reading some buttons to make it standalone/adjustable

byte ones_hours = 9;

byte tens_minutes = 2;

byte ones_minutes = 6;

byte tens_seconds = 0;

byte ones_seconds = 0;

byte tenths = 0;

byte hundredths= 0;

byte prior_seconds = 0;

void setup()

{

Serial.begin(57600);

}

void loop()

{

currentmicros = micros(); // read the time.

while (currentmicros - previousmicros >= interval) // 10 milliseconds have gone by

{

hundredths = hundredths +1;

if (hundredths == 10){

hundredths = 0;

tenths = tenths +1;

}

if (tenths == 10){

tenths = 0;

ones_seconds = ones_seconds +1;

}

if (ones_seconds == 10){

ones_seconds = 0;

tens_seconds = tens_seconds +1;

}

if (tens_seconds == 6){

tens_seconds = 0;

ones_minutes = ones_minutes +1;

}

if (ones_minutes == 10){

ones_minutes = 0;

tens_minutes = tens_minutes +1;

}

if (tens_minutes == 6){

tens_minutes = 0;

ones_hours = ones_hours +1;

}

if (ones_hours == 10){

ones_hours = 0;

tens_hours = tens_hours +1;

}

if (tens_hours == 3){

tens_hours = 0;

}

previousmicros = previousmicros + interval; // update for the next comparison

}

// counters are all updated now,

if (prior_seconds != ones_seconds){

Serial.print (tens_hours, DEC);

Serial.print (" ");

Serial.print (ones_hours, DEC);

Serial.print (" : ");

Serial.print (tens_minutes, DEC);

Serial.print (" ");

Serial.print (ones_minutes, DEC);

Serial.print (" : ");

Serial.print (tens_seconds, DEC);

Serial.print (" ");

Serial.println (ones_seconds, DEC);

prior_seconds = ones_seconds;

}

} // end void loop