On Thursday 13 March 2014 20:45 Arvid Fahlström Myrman wrote:
> 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.

As libiphb is not guaranteed to be accurate, I set the Insomniac to wake up a 
few seconds before I need the alarm to trigger, then start a Timer. You could 
do the same: Wake up, check time and start a normal Timer.
Or am I missing something?

-- 
Med venlig hilsen / Best Regards

Thomas Tanghus
_______________________________________________
SailfishOS.org Devel mailing list

Reply via email to