keeping time while sleeping

Hi

I'm trying to put the processor to sleep and only wake up when receiving an interrupt from an accelerometer.

The problem is, I need to be able to "keep time" of each interrupt so that I can group the events "per hour".

I was thinking of using millis() to determine the time for the event, and then decide on whether or not to increment the "event_timer" or not based on whether the difference between the current and first millis() amount is less than an hour. If not, then I reset the counter.

I know that the accelerometer has two interrupt pins on pin 9 and 13, but I cannot find examples of how to "listen" for an interrupt, and whether millis() can still "run" while the Arduino CPU is in sleep mode?

http://playground.arduino.cc/Learning/ArduinoSleepCode

When using SLEEP_MODE_IDLE, care must be taken to ensure that the 8-bit timer is disabled if you're using the arduino layer. ... One must note that if this timer is disabled, the millis(); cannot be relied upon anymore if you need reliable data comparison before and after a sleep command.

That page also has loads of examples on how to listen for interrupts...now...not to be mean...but I found that on 1 google search of "arduino sleep" as the first suggested link.

If you want to keep time, I suggest getting yourself an RTC (Real Time Clock), DS3231 is a really good choice as it is temperature controlled, which means it is accurate. There is also libraries for it as well.

Also, if you are more generally interested in minimising power consumption read this.

For example, there may be little point in saving a few mA putting the chip into sleep mode when the voltage regulator, USB interface and power LED are taking over 50mA.