Getting Notification of System Time Change

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: vasant21 (07 May 2007)
Last edited: hamishwillee (23 Jul 2012)

For getting the Notification of System Time Change, we can use RTimers.

The At timers terminates with KErrAbort when the system time changes, the timer can be used to monitor changes in system time.

Implement a simple Active Object and Use RTimer to get notification of System Change.

To get complete idea about Active Object with example refer Active Objects section on wiki.

TTime CurrentTime;
// Issue an Asynchronous Request //
iTimeWaster.At(iStatus, CurrentTime + TTimeIntervalYears(2));
// set it to active once request is issued //

Now in the RunL() of your Active Object, you can catch KErrAbort when the System Time is changed, as timer will terminate with KErrAbort when the system time is changed.

void CSomeActiveObject::RunL()
// This is the case when system time is changed and
// hence will cause the timer to abort with KErrAbort.
if(iStatus.Int() == KErrAbort)
// Do Something ...

For testing the System Time Change Notification, you can run your program in the background and change the system time from Tools >> Clock >> Settings >>Time, your RunL() method will be called with iStatus = KErrAbort.

See the ready to run example.

"HelloWorldBasic(TimeChanged).zip" File:Helloworldbasic(TimeChanged).zip

This page was last modified on 23 July 2012, at 10:40.
61 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.