Unfortunately, I currently don't have an Arduino at hand, so I have to ask instead of testing it myself:
offers the commands
adjustTime(number); //number of seconds to add to time setTime(hours, minutes, seconds, day, month, year); setSyncProvider(RTC.get); // get time from I2C Real Time Clock (DS1307, ...)
If I interpret the code correctly: "setTime" and "adjustTime" only change the time on the microcontroller. So if a RTC (with a wrong time) has been declared as a time provider with "setSyncProvider", after the next sync the microcontroller will again display the wrong time. Is this correct?
So my current program to change both times almost simultaneously (as opposed to only correct the RTC and wait for the next syncInterval to finish) looks like this
//wrong time in both microcontroller and RTC //correct data in hours, minutes, ... variables setTime(hours, minutes, seconds, day, month, year); RTC.set(now());
//offset holds number of seconds between wrong and correct time adjustTime(offset); RTC.set(now()+offset);
Or is there some unnecessary underlying code repetition included?