Keeping time in sleep mode

The watchdog timer is inaccurate, not adjustable and is not meant for timekeeping.

The CPU clock does not run in sleep mode. However, it is possible to have a 32kHz watch crystal running Timer2 in asynchronous mode, and keep time with that even in the “deepest” sleep modes. In that case the CPU can run using the built-in 8 MHz RC oscillator when awake. You will have to replace the 16 MHz crystal on your board with a watch crystal in order to experiment with that mode (and be sure to set the fuses for LP Xtal and have the CPU use the RC oscillator). I posted some code for this here: (see reply #9)