Here it is.. the whole library. It includes a test in the init to detect the RTC (if you have the I2C scanner mod I posted here). Setting the time using the old method or the new epoch functions which also calculates US and EU (even pre 2006 if needed!) DST and calculates the GMT offset (configurable at compile). And yes that function is almost as big as the rest of the driver! The old way of getting the time is still the current one as it's a lot more practical for printing in a strftime-less environment. But for good measure I added a way to get the current Epoch (doesn't care about dst!, but if you need that it should be easy to fix). My only issue right now is that OSCF (oscillator flag), which would be nice for the original time setting condition. But the time seems to stay accurate (at least after a few hours).
The RTC config "rtcConfig.h":
#ifndef RTC_CONFIG_H
#defin#ifndef RTC_CONFIG_H
#define RTC_CONFIG_H
/**
* Set this to your local GMT offset
* Comment to skip GMT offset calculations
**/
#define RTC_GMT_OFFSET -5
/**
* Select your DST type
* Comment all to skip DST calculation
**/
#define RTC_DST_TYPE 0 /* US */
//#define RTC_DST_TYPE 1 /* EU */
// Uncomment this only if you need to check DST prior to 2006
//#define RTC_CHECK_OLD_DST
#define RTC_DOW_1 PSTR("Sun") /* First day of the week */
#define RTC_DOW_2 PSTR("Mon")
#define RTC_DOW_3 PSTR("Tue")
#define RTC_DOW_4 PSTR("Wed")
#define RTC_DOW_5 PSTR("Thu")
#define RTC_DOW_6 PSTR("Fri")
#define RTC_DOW_7 PSTR("Sat")
#define RTC_DOW_0 RTC_DOW_4 /* Wednesday is the first day of Epoch: This probably shouldn't change! */
#endif
Rest to follow....
EDIT: Pre 2006 check is now optional to save space.