Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32std.h
Link against: euser.lib

Class RTimer

RTimer

Support

Supported from 5.0

Description

Asynchronous timer services.

Four types of asynchronous request are supported by the class:

Each of these requests can be cancelled.

The timer exists from its creation following a call to RTimer::CreateLocal() until it is destroyed by a call to the Close() member function of the base class RHandleBase.

Note that the CTimer active object uses an RTimer.

Derivation

RHandleBaseHandle to an object
RTimerAsynchronous timer services

Defined in RTimer:
After(), At(), Cancel(), CreateLocal(), Inactivity(), Lock()

Inherited from RHandleBase:
Close(), Duplicate(), Handle(), SetHandle()

See also:


Construction and destruction


CreateLocal()

TInt CreateLocal();

Description

Creates a thread-relative timer.

Return value

TInt

KErrNone if successful, otherwise another of the system-wider error codes.

[Top]


Request a timer event


After()

void After(TRequestStatus& aStatus,TTimeIntervalMicroSeconds32 anInterval);

Description

Requests an event after the specified interval.

The counter for this type of request stops during power-down. A 5 second timer will complete late if, for example, the machine is turned off 2 seconds after the request is made.

If this function is called while a request for a timer event is still outstanding, then it raises a KERN-EXEC 15 panic.

Parameters

TRequestStatus& aStatus

On completion, contains the status of the request. This is KErrNone if the timer completed normally at the requested time, otherwise another of the system-wide error codes.

TTimeIntervalMicroSeconds32 anInterval

The time interval, in microseconds, after which an event is to occur. This value cannot be negative, otherwise the function raises a USER 87 panic.


At()

void At(TRequestStatus& aStatus,const TTime& aTime);

Description

Requests an event at a given system time. If the machine is off at that time, it is automatically turned on.

If this function is called while a request for a timer event is still outstanding, then it raises a KERN-EXEC 15 panic.

Parameters

TRequestStatus& aStatus

On completion, contains the status of the request:KErrNone — the timer completed normally at the requested time.KErrCancel — the timer was cancelled.KErrAbort — the timer was aborted because the system time changed.KErrUnderflow — the requested completion time is in the pastKErrOverFlow — the requested completion time is too far in the future.

const TTime& aTime

The time at which the timer will expire.


Lock()

void Lock(TRequestStatus& aStatus,TTimerLockSpec aLock);

Description

Requests an event on a specified second fraction.

If this function is called while a request for a timer event is still outstanding, then it raises a KERN-EXEC 15 panic.

Parameters

TRequestStatus& aStatus

On completion, contains the status of the request:KErrGeneral, the first time this is called; KErrNone, the timer completed normally at the requested time.KErrCancel, the timer was cancelled; KErrAbort, the timer was aborted because the system time changed; KErrUnderflow, the requested completion time is in the past; KErrOverFlow, the requested completion time is too far in the future.

TTimerLockSpec aLock

The fraction of a second at which the timer completes.


Inactivity()

void Inactivity(TRequestStatus& aStatus, TTimeIntervalSeconds aSeconds);

Support

Supported from 6.0

Description

Requests an event if the specified time interval elapses without user actvity.

If there has already been a period of user inactivity greater than the specified inteval, then the timer is set after the next user activity.

If this function is called while a request for a timer event is still outstanding, then it raises a KERN-EXEC 15 panic.

Parameters

TRequestStatus& aStatus

On completion, contains the status of the request:KErrNone — the timer completed normally.KErrCancel — the timer was cancelled.

TTimeIntervalSeconds aSeconds

The time interval.

[Top]


Cancel a timer


Cancel()

void Cancel();

Description

Cancels any outstanding request for a timer event.

Any outstanding timer event completes with KErrCancel.