Set the expiration time for a timer
#include <sys/neutrino.h> int TimerSettime( timer_t id, int flags, const struct _itimer * itime, struct _itimer * oitime ); int TimerSettime_r( timer_t id, int flags, const struct _itimer * itime, struct _itimer * oitime );
If the flag isn't specified, nsec represents a “relative” expiration period that's offset from the given clock's current system time in nanoseconds.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The TimerSettime() and TimerSettime_r() kernel calls set the expiration time of the timer specified by id.
These functions are identical except in the way they indicate errors. See the Returns section for details.
|Instead of using these kernel calls directly, consider calling timer_gettime() or timer_settime().|
The expiration is specified by the itime argument. The _itimer structure contains at least the following members:
If the nsec member of itime is zero, then the timer is disarmed.
If the interval_nsec member of itime is nonzero, then it specifies a repeat rate which is added to the timer once the nsec period has expired. Subsequently, the timer is automatically rearmed, causing it to become repetitive with a period of interval_nsec.
If the timer is already armed when you call TimerSettime(), this call discards the previous setting and sets a new setting.
If the event notification specified by TimerCreate() has a sigev_code of SI_TIMER, then at most one event is queued. In this case, if an event is pending from a previous timer when the timer fires again, a timer overrun occurs. You can use the TimerInfo() kernel call to obtain the number of overruns that have occurred on this timer.
|Because of the nature of time measurement, the timer might actually expire after the specified time. For more information, see the Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide.|
This call doesn't block.
The only difference between these functions is the way they indicate errors:
timer_gettime(), timer_settime(), TimerCreate(), TimerInfo()
Clocks, Timers, and Getting a Kick Every So Often chapter of Getting Started with QNX Neutrino
Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide