NerdKits demonstrates how make a Microcontroller Real Time Clock using system Crystal Oscillator by using system interrupts.
"This project demonstrates a minimal piece of code that shows how to use interrupts, as well as the ATmega168’s onboard Timer/Counter modules, to divide the 14745600 clock cycles per second down to just 100, and to keep time accurately in seconds."