RTC and Arduino Create (Online Editor)

Hi there,

So I am playing around with a cheap SD Card and RTC shield that I picked up. So far so good - everything is working fine. But! My clock is always 5 hours ahead… I understand the differences in compiling time vs displayed time… but this is always 5 hours off…

My thought is that since I am using a chromebook and I am limited to using the Online editor (well, actually… just an fyi for Chromebookers… you can pretty easily install linux with Crostini and have more capabilities…like running standard Arduino IDE on a $300 computer,… but let’s just say i was sick of running in developer mode all the time and needed a ‘normal computer’ for work)… so I am wondering if the online editor isn’t using my computer’s local time, but rather the “cloud” time that its running. Could this explain the time difference?

Any feedback on this would be appreciated.

Secondly, I am using the RTClib.h library… any thoughts on how I could artificially adjust the time so that it actually functions as a clock. I’m just building a timer, so not having the perfect time doesn’t mean the project will fail. It just seems a little, uhhh, well… ugly.

Thank you in advance. I’ve learned so much on this forum. Thank you for all the positivity!

Secondly, I am using the RTClib.h library… any thoughts on how I could artificially adjust the time so that it actually functions as a clock.

Isn’t there an example with the library that lets you set the time? Once you set the time on the RTC it should stay unless the battery is dead. So load that example, set the time, then load your code and go.

The examples which come with the library are very very basic. They are just intended to show you that it works

This is an issue even on full PCs because the time set is the time that compilation started, which is a few seconds late by the time it reaches the Arduino.

For my RTC projects where this matters, I include a GPS parser so any time my device gets GPS data it resets the RTC. That gets me well under 1 second difference from real time.

For you to get started, I suggest you modify the basic setting example to set the time, then request the time from the RTC, subtract 5 hours and set it again.