Skip to content

Fix digital clock date drift

David Edmundson requested to merge work/clock_drift into master

dateTimeChanged is called every second. This in turn checks if the date has changed. If so we call setupLabels which updates the clock.

The date label used to use main.currentTime which is a value set in the binding of the timeLabel's text property. They are both connected to the data source updating, but the order they run in will be undefined.

Bug 1: We compare an ever so slightly different date source to the one used in the date text label. Multiple DataEngines do not have synced times.

Bug 2: We are not necessarily updating the date label with the most updated time.

If either of these are out of sync we would not show the right date.

Overall we can't mix declarative and imperative design patterns. This patch commits to being imperative and introduces a function to get the current time from the data source rather than having this potentially out of sync cache.

BUG: 452554

--

Mid-term I do intend to just rewrite this thing to something with a nice Declarative backend which has properties for formatted strings and correct change signals and a shared underlying timer...it'll be amazing.

Merge request reports