[SailfishDevel] QML Timer stops running
Thomas Tanghus
thomas at tanghus.net
Wed Jan 15 10:54:22 UTC 2014
On Wednesday 15 January 2014 08:26 Jonni Rainisto wrote:
> Hi,
>
> For the love of ***,
:D
> dont use libiphb every 5 seconds, that will kill
> batterylife for suspend (store QA will reject apps that eat battery). Its
> more meant to be triggered every 10, 15, 30 etc. minutes. So if you want to
> make 25 minute timer that works even while suspended, then you should do
> libiphb to wake up after 25 minutes.
The reason for the 5-10 second wakeup is that I want to update cover until
screen goes black, and I haven't found a way to detect that, and
applicationActive doesn't do it. Maybe my search-foo looked for the wrong
keywords.
> Or if you want to make libiphb to wake up device every 10 minutes, you can
> make your application to check how much time has really passed since last
> wakeup by checking hw clock (as that is the only clock which is updated
> even while beeing suspended) timestamps like this:
>
> static void tv_get_monotime(struct timeval *tv)
> {
> #if defined(CLOCK_BOOTTIME)
> struct timespec ts;
> if (clock_gettime(CLOCK_BOOTTIME, &ts) < 0)
> if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0)
> qFatal("Can't clock_gettime!");
> TIMESPEC_TO_TIMEVAL(tv, &ts);
> #endif
> }
Thanks for the snippet. That will come in handy.
--
Med venlig hilsen / Best Regards
Thomas Tanghus
More information about the Devel
mailing list