Hey there, I'm trying to get the Adafruit PCF8523 to tell me the accurate time.
I'm using the included sketch to reset the time of it. Here is the snipped that I'm using
void setup() {
...
initializeRTC();
...
}
void initializeRTC() {
//detect if Real Time Clock (RTC) is connected
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
while(1) delay(10);
}
Serial.println("RESET RTC to now");
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
if (! rtc.initialized() || rtc.lostPower()) {
Serial.println("RTC is NOT initialized, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}
rtc.start();
}
this does set the time, but it appears to be off by about 8 hours?
Using Unix Time Stamp - Epoch Converter I examined what the timestamp was coming out of there versus the timestamp coming off of the logging for the Arduino
unixtimestamp.com: 1639008937
arduino: 1638981100
that's a difference of 27,837 seconds or 7.7325 hours
This result seems #1 arbitrary and #2 close to my UTC offset (GMT-8)? But since it isn't exact, I'm thinking that's a red herring.