skylark, here is a tweek to your sketch you may want to play with. some of the time delay error you noticed will be do to the delays outputting to the serial port, however you avoid this as follows.
int start;
int clockadjust = 1000;
void loop() {
while(millis() - start < clockadjust) // wait for clockadjust milliseconds to elapse
;
long start = millis(); // save the next start tick
// now update time variables and do serial output
// paste your calculation and serial code here
}
void setup() // run once, when the sketch starts
{
Serial.begin(9600);
start = millis(); // get the start tick for the first iteration through the loop
}
The code is untested but I hope it gives a useful idea of how to make the clock more accurate