[SailfishDevel] QML Timer stops running
Ove Kåven
ovek at arcticnet.no
Tue Jan 14 00:53:37 UTC 2014
Den 13. jan. 2014 23:04, skrev Thomas Tanghus:
> Just after having my tiny Kitchen Timer app approved I realized that the
> timer slows down and eventually stops running - burned food as result :(
>
> The timer is set to trigger each 1000 ms. When applicationActive becomes
> false the timer slows down to being triggered appr. each 5000 ms and after
> about a minute more it stops running all together.
>
> Am I missing something obvious?
No matter what OS or platform you're on, counting the number of times
your timer callback is called is *never* a good idea, even on desktop
PCs. Timer callbacks can be skipped for any number of reasons (heavy
system load, laptop suspend, etc).
If you look at the QML example code for Timer, they don't do that. They
use Date() to get the current time. You should do something like that,
too. Then your clock would always show the correct time (as long as it's
running at all, at least).
More information about the Devel
mailing list