In projects where clocks are involved it is best to use specialized Real Time Clock (RTC) chips. They require little power to run and frees main processor from counting time which may result in better efficiency. If you are building AVR project, you may consider using DS1307 RTC chip.
Davide prepared a simple library to interface and set up this chip. Library is written for AVR GCC compiler.