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

From: David Greaves david at dgreaves.com
Date: Sun Jan 31 10:36:36 EET 2010
ibrahim wrote:
> Remi.Denis-Courmont at nokia.com 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

-- 
"Don't worry, you'll be fine; I saw it work in a cartoon once..."
More information about the maemo-developers mailing list