7.7.7 sg::Timer class

This section describes the Timer interface class. The SchedulerInterfaceForComponents::createTimer() method creates Timer objects.


This method unsets the timer so that it does not fire.

void cancel();

If the timer is not set, this method has no effect.


This method destroys Timer objects.


The timer must not call TimerCallback::timerCallback() after the destruction of this object.


This method returns the name of the instance that owns the object.

const char *getName() const;

This is the name that createTimer() received.

Timer inherits this method from sg::SchedulerObject.


This method returns true if the timer is set and queued for call-back, otherwise false.

bool isSet();

This method has no side effects.


This method requests the remaining number of ticks relative to simulated time resolution until a timer makes a signal.

ticks_t remaining();

This method returns 0 if there are no ticks remaining or if the timer is not set.

This method has no side effects.


This method sets a timer to make a signal.

bool set(ticks_t ticks);
the number of ticks after which the timer is to make a signal.

The signal that this method makes is a call to the user call-back function. If the return value t is 0, the timer does not repeat, otherwise it repeats after t ticks. The latest set() overrides the previous one.

This method returns false if ticks is too big to schedule the timer.


This method sets the frequency source clock for the timer. Arm deprecates this v0 function. Simulated time is now relative to global time resolution. See SchedulerInterfaceForComponents::getSimulatedTimeResolution() and SchedulerInterfaceForComponents::setSimulatedTimeResolution().

Non-ConfidentialPDF file icon PDF version100965_1105_00_en
Copyright © 2014–2018 Arm Limited or its affiliates. All rights reserved.