Simple RTC class based on DS1307. Emphasis on simple. Allows you to run at 100k or 400k Hz (for newer DS1307 capable devices). MapTime() allows you to set the time() service to the same as the RTC. Uses struct tm throughout so you can use traditional time functions for manipulation.

Dependents:   AdaFruit_RGBLCD

Revision:
15:1645f55bd0ee
Parent:
14:d5b47ff12d17
Child:
16:f7e4b4cbfb9e
--- a/RTclock.cpp	Wed Oct 08 16:41:28 2014 +0000
+++ b/RTclock.cpp	Wed Oct 08 16:57:04 2014 +0000
@@ -37,7 +37,7 @@
     if (m_bTwelveHour)
     {
         // add 12 hours if PM bit is set and past midday
-        out_sTM.tm_hour = bcdToDecimal(aBuffer[2] & 31);
+        out_sTM.tm_hour = bcdToDecimal(aBuffer[2] & 0x1f);
         
         bool bPM = (0 != (aBuffer[2] & 0x20));
         if (bPM && 12 != out_sTM.tm_hour) out_sTM.tm_hour += 12;