From 0c275c5e728852dc349a604f5e3f17aec03cdce1 Mon Sep 17 00:00:00 2001 From: GuruSR Date: Mon, 27 Dec 2021 00:26:38 -0500 Subject: [PATCH] DS3231 & PCF8563 working WatchyRTC. --- src/WatchyRTC.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/WatchyRTC.h b/src/WatchyRTC.h index ea5350b..1f10216 100644 --- a/src/WatchyRTC.h +++ b/src/WatchyRTC.h @@ -8,8 +8,11 @@ #define PCF8563 1 #define RTC_DS_ADDR 0x68 #define RTC_PCF_ADDR 0x51 -#define YEAR_OFFSET_DS 1970 -#define YEAR_OFFSET_PCF 2000 +#define RTC_YEAR_OFFSET 1900 // Use for calculation to display year properly. +#define RTC_CENTURY_OFFSET 100 // Short Year offset. +#define RTC_1900TO1970 2208988800UL // Subtract from NTP to get Epoch. +#define RTC_1970TO2000 946684800UL // Subtract from Epoch to get Y2k. +#define RTC_1900TO2000 (RTC_1900TO1970 + RTC_1970TO2000) // Subtract from NTP to get Y2k. class WatchyRTC { public: @@ -31,4 +34,4 @@ class WatchyRTC { String _getValue(String data, char separator, int index); }; -#endif \ No newline at end of file +#endif