David Greaves wrote:
ibrahim wrote:
[email protected] wrote:
   Hello,

----- Message d'origine -----
But the problem that can face me is the case when the user changes his
clock settings (i.e adjust phone's time to a different time). in this
case, the timer that has been set to some fixed duration can go wrong.
As a general rule, delay measurements should be done with the
monotonic clock, not the wall clock (the real-time clock). As far as I
know, Qt timers already do so internally. But of course, your own code
should never request and use the wall clock for time measurements.

I don't think I follow you! What do you mean by monotonic clock ? If I
don't depend on the system's clock to get current time, where else can I
get it from ?
Let me explain my problem again briefly, I want to know the current
time, calculate some future durations  depending on it. Then I figure
out the time left to the upcoming duration and set it as interval to a
QTimer Object. But I'm afraid that user may change the system clock
(adjust the clock) So that my preset time will be invalid.

Just so you know... you're describing an implementation and asking if it does
what you want without describing what you want.

Example: "At 4am the user wants to play a sound at 8am (in 4hrs). At 6am the
user changes timezone and it becomes 7am. The alarm should sound at 8am in the
new timezone."

My guess is that you know about interval timers but you should be using a
wall-clock. Since you haven't specified what you want it's hard to know.

David

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
_______________________________________________
maemo-developers mailing list
[email protected]
https://lists.maemo.org/mailman/listinfo/maemo-developers

Reply via email to