Adjusting time in RTC on Data Logger Shield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
bspindor
 
Posts: 1
Joined: Tue Jul 27, 2021 11:27 pm

Adjusting time in RTC on Data Logger Shield

Post by bspindor »

I'm looking for a methodology to adjust the time in the RTC of the Data Logger Shield (DLS) after it has been set. For example, on a regular interval (whether that be once a day or every 4 hours) I want the DLS to connect with an NTP site or another computer, get the current time, and compare the time with the RTC time. It the time is within a standard difference (say less than a second) do not update the RTC, and if outside of the standard difference (more than a second) then update the time on the RTC.

I would appreciate any help with this topic. Thanks in advance!

User avatar
dastels
 
Posts: 15656
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adjusting time in RTC on Data Logger Shield

Post by dastels »

It looks like you just need to call adjust on the RTC object with the new time/date. See https://learn.adafruit.com/adafruit-dat ... time-clock You'll also need a network connection for fetching the time.

That said, the idea of using an RTC is to not need to regularly check a time server. Which is exactly what you want for a datalogger using local storage.

Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”