Slightly modified of the TimeAlarms arduino library (http://www.pjrc.com/teensy/td_libs_TimeAlarms.html).