Re: Synchronising an app with the system clock



On Wed, 2007-02-14 at 19:28 +0000, Alex Jones wrote:

> [...]
> 
> I initially thought of just checking the current time, and then
> calculating how long until the hour, and sleeping until then. There is a
> problem with this, however, in that if the time changes, the alarm will
> go off at the wrong time as it has no knowledge of the clock change.
> 
> What I want to do is have some way of absolutely synchronising an app
> with the system clock. I've considered a kind of D-Bus system clock
> service that could emit signals every second so that apps could
> synchronise to that and all dance in time, but that itself would need
> synchronising somehow, so the problem remains. Is there some way to
> interface with the kernel for this kind of thing?
> 
> Any other ideas/comments?

I think the correct solution would be a D-Bus signal that would be sent
when the clock was adjusted significantly.

Waking up every second, or waking everyone up every second, makes for
poor performance. The OLPC team specifically went and fixed issues like
that to conserve battery power.

In the meantime, I'd advise you to figure out how much of an error is
acceptable in the rare event that the clock gets adjusted, and wake up
accordingly - e.g. every 15 minutes.

-- 
Hans Petter




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]