[SailfishDevel] Scheduling code for execution at x seconds since epoch

Arvid Fahlström Myrman behold at behold.se
Thu Mar 13 19:45:25 UTC 2014


Hi,

Does anyone know if it is possible to schedule code for execution at x seconds 
since epoch, with guaranteed execution even when in sleep mode? Currently I am 
using libiphb (through tanghus's Insomniac QML plugin), but libiphb only seems 
to support waiting for a specified number of seconds, meaning that if iphb_wait 
is called when the time is 1394730709733 milliseconds since epoch and is 
instructed to wait for 5 seconds, the code will be executed sometime around 
1394730714733 milliseconds since epoch. I want to be able to schedule code to 
be run at e.g. 1394730715000 (±50 ms or some such small margin), i.e. whole 
seconds since epoch, no matter the current time. That way for example 
WallClock from org.nemomobile.time would be in sync with my timer, and I could 
accurately reflect the remaining time in the GUI by updating on onTimeChanged 
without having to update the GUI unnecessarily often, in addition to other 
simplifications I would be able to make.

Using the standard QtQuick Timer type would work, since it supports specifying 
the interval in milliseconds, so you could do something like timer.interval = 
1394730715000 - Date.now(), however Timer doesn't work when in sleep mode.

Regards,
Arvid



More information about the Devel mailing list