When calling getEpoch it returns an Epoch that is 36 years (!) in the future, despite date and time are set and shown correctly.
Simple test code:
#include <Arduino.h>
#include <I2C_RTC.h>
static PCF8563 RTC;
void setup(void) {
Serial.begin(9600);
while (!Serial)
;
// Start RTC and check status
RTC.begin();
if (!RTC.isRunning()) {
RTC.setDateTime(__DATE__, __TIME__);
RTC.updateWeek();
}
}
void loop(void) {
if (RTC.isRunning()) {
Serial.print("Time: ");
Serial.print(RTC.getHours());
Serial.print(":");
Serial.print(RTC.getMinutes());
Serial.println();
Serial.print("Date: ");
Serial.print(RTC.getDay());
Serial.print("-");
Serial.print(RTC.getMonth());
Serial.print("-");
Serial.print(RTC.getYear());
Serial.println();
Serial.print("Epoch: ");
Serial.print(RTC.getEpoch());
Serial.println();
delay(1000);
}
}
Output:
Time: 9:35
Date: 31-8-2023
Epoch: 2832768244
When calling getEpoch it returns an Epoch that is 36 years (!) in the future, despite date and time are set and shown correctly.
Simple test code:
Output: