how to keep time on an arduino

Perhaps running this millis() command.
First, calculate what (milli)second of the day it is. For example, 24 hours * 60 minutes* 60 seconds. If its 1:13 AM, it would be 613 minutes into the day, and about 3600 seconds. Put that into the serial monitor. Then, perhaps, by creating two variables; the millis() reading at that moment and the serial number. I believe to store it you can use Serial.parseInt(). To print the time, use millis(), then subtract the original millis variable you created. Finally, add the millis since 12 AM. Then, you can do math to figure out the hour, minutes, and seconds. I'm not going to provide code, but modulo (look it up) will be useful.

Accuracy depends. If you want really good accuracy, you can get a higher-quality clock and wire it in to the Arduino's ATMEGA chip. That would be more accurate. Depending on your math, this would be fairly accurate, down to the millisecond. (Every time you reset the arduino, however, you'd need to reset the clock, unless you used EEPROM.)