[maemo-developers] sensing change in System Clock using Qt

From: ibrahim ibrahim.ali at asgatech.com
Date: Sun Jan 31 15:04:36 EET 2010
nomrasco wrote:
> ibrahim wrote:
> > I am very sorry for not making my question clear enough. But the
> > situation you just described is JUST what I want to do! Yes, I want to
> > do something exactly as you described; I am now at 4:00 am, I need to
> > make my app do something at - say - 8:00 am (the time of the alarm is
> > calculated and varies from time to time, so i can't just use cron jobs
> > to schedule the next alarm), So, I used a QTimer and set its interval to
> > the duration between now and the next alarm. BUT this solution won't
> > work if user decides to adjust the system clock/change timezone.
> > What I'm asking is there anyway to GET NOTIFIED by the system when > its
> > clock/timezone changes (in order to recalculate the next alarm and set
> > my Qtimer object to a new duration)?? any signal emitted ? anything?
> > I hope i made my question clear and sorry for any inconvenience.
> > thanks again
> Hi,
>    You should check libalarm API and its feautures 
> (http://maemo.org/api_refs/5.0/5.0-final/libalarm/). It provides You 
> exactly what You want... the only problem is that it is in pure C. You 
> can add alarm and forget about QTimer etc. Device could be even boot 
> up on You alarm if that is a behaviour You would like to get (and 
> device was switched off before Your alarm;) ). It should not be to 
> hard to use this library in Qt code. Furthermore, You can check 
> another library provided by Nokia - libtime 
> (http://maemo.org/api_refs/5.0/5.0-final/clockd/). It allows You to 
> communicate with clockd which is responsible for maintaining time on 
> the device. clockd daemon also sends D-Bus signal 
> (http://maemo.org/api_refs/5.0/5.0-final/clockd/libtime_8h.html just 
> at the top of the page :) ) after time was changed by the user or time 
> was synchronized and changed to different GMT offset (this is not 
> working with every GSM network though).
>    So.. fast reply for Your question is: signal send by clockd. Better 
> solution: use libalarm which will save You a lot of time :)
> Best Regards
> -- 
> nomrasco
> software development
thank you very much for your response. I will try both your and faheem's 
answers. will get back to you soon if everything happens
thanks again
More information about the maemo-developers mailing list