On 14/01/14 01:14, Thomas Tanghus wrote: > On Tuesday 14 January 2014 01:53 Ove Kåven wrote: >> 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). >> ... > Good point. That will also at least work around the issue when in "pre-deep- > sleep".
I agree with Ove (that is how every timer function I have ever worked on works, from interrupt handlers in embedded system kernels through to the GPE Calendar app) -- repeating timers are a convenience, but are never treated as accurate. But I would also suggest that for any apps that do timing, when the app is not being displayed (and so the screen doesn't need to be updated), the code should switch to using a single-shot timer set to the time when the next event happens, instead of using repeating timers. If the kitchen timer is set for 25 minutes and the screen is blank you don't want your app waking up every second. Of course, it is a little bit tedious to write the code to cancel the long timer and restart short timers when the screen is turned back on but the user will thank you for it. Unfortunately, I have no idea how you actually set up a single shot timer that will fire correctly in deep sleep from the Qt environment (the last time I implemented that logic was on Maemo). Graham _______________________________________________ SailfishOS.org Devel mailing list