What I do is, use RTC.adjust(DateTime(DATE, TIME)); in a sketch which I only ever run when the RTC's gone out enough for me to worry about, and which does nothing more than set the RTC to that new compile time.
Then in the sketch where I use the time, I only ever access it, not set it.
Every now and then if the RTC's out, I dust off the other sketch and reset the clock.
(BTW, the compile time is a second or so older than the RTC time, presumably because of the latency involved in the upload process, but I've never worried about that.)
manor_royal:
(BTW, the compile time is a second or so older than the RTC time, presumably because of the latency involved in the upload process, but I've never worried about that.)
I find the RTC can be set most accurately by releasing the reset on the time stroke.
I used the on line ardiuno ide, and it sets the time of their system when using date time now to set the rtc! How would I get it to use my system time?