Check rtc.isValid() for PCF8523

Hi, I’m brand new to writing code so please forgive me if this question insults anyone. I’m using a Boron and a PCF8523 RTC and @rickkas7 Adafruit_RTClibrary_RK library. I’m looking for an rtc.isValid() function in .CPP or .h files and I don’t see it. All my data records need to be timestamped so I have to know if the PCF has a valid time. If not, I’ll need to connect to the Particle Cloud and adjust it. Is that function not included in the library? Again, please forgive the question. :pray: Thanks!

There isn’t one. The best option is to have a flag so once Time.isValid() is true the first time after restart, you set the RTC. Even if the RTC has a valid time, it will eventually drift, so resetting it at every startup isn’t a bad idea.

Thanks @rickkas7! Makes sense.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.