adjustTime(number) problem when adding seconds

Status
Not open for further replies.

Panoramix

New member
As you can see, I added some test code to the existing example TimeTeensy3. With test set to HIGH you can see that the clock doesn't advance beyond 5 minutes or so.

With test set to LOW the clock advances OKE.

Seems that there is a problem with adjustTime?

adjustTime.jpg setTime.jpg

>>> Added code <<<<
boolean test=HIGH;
if (test) {
adjustTime(120); // Does not work beyond 5 min. when test=HIGH
} else {
setTime(now()+120); // Works perfect when test=LOW
}
 
Hello,

with adjusttime() you set timelib object but not the RTC on Tennsy 3.x.
In setup() you have set syncronisation of timelib with teensy-RTC by "setSyncProvider(getTeensy3Time)". Default time for sync is 300 seconds (5 minutes). You can change this by "setSyncInterval(seconds)".
So after 5 minutes your before adjusted time in timelib (+120) ist resyncronised with RTC an set with value of RTC.
Bear in mind timelib and RTC are two independent objects.
Of course you can also adjust RTC with "Teensy3Clock.set(t)".
 
Status
Not open for further replies.
Back
Top