03-01-2018 05:54
03-01-2018 05:54
I developed a watch face (LCD style with a few PNGs) and I've noticed that 1-2 seconds are missing every 10-15 seconds.
Is there an issue with this API? Or just performance?
Not that I care much, but I would love to understand a bit what's going on...
Answered! Go to the Best Answer.
03-02-2018 10:12
03-02-2018 10:12
Found it. I was using setInterval(clocker, 1000) as in the sample provided. The right way though is to use:
clock.granularity = "seconds";
clock.ontick = (evt) => {
clocker(evt.date);
}
This is more accurate then setting the interval.
The sample code should be updated to use this.
03-01-2018 16:27
03-01-2018 16:27
Are the images flickering, or do you think it's just skipping the tick event entirely?
You could try adding `load="sync"` on your <image> tags.
Are you doing much other processing within the tick event? And are you using the date object from the event itself, or are you instantiating a new date object?
03-02-2018 08:42
03-02-2018 08:42
It's not flickering at all, it's just skipping seconds.
I am instantiating a new date and not using sync. Let me make these changes and get back to you.
I use the LCD sample on github as starting point.
03-02-2018 10:12
03-02-2018 10:12
Found it. I was using setInterval(clocker, 1000) as in the sample provided. The right way though is to use:
clock.granularity = "seconds";
clock.ontick = (evt) => {
clocker(evt.date);
}
This is more accurate then setting the interval.
The sample code should be updated to use this.