Arm a timer with the given expiration time, disarm it, or set its tolerance
#include <time.h> int timer_settime( timer_t timerid, int flags, const struct itimerspec * value, struct itimerspec * ovalue );
If you don't set this bit, the it_value represents a relative expiration period that's offset from the current system time by the specified number of seconds and nanoseconds.
The following are QNX Neutrino extensions:
If you specify the TIMER_TOLERANCE flag, this argument can be NULL.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The timer_settime() function either sets the expiration time of the timer specified by timerid, or sets the tolerance for that timer, depending on the flags provided. When you don't specify TIMER_TOLERANCE, the expiration time is set from the it_value member of the value argument. If it_value is non-zero, then the timer is armed (or rearmed). If this member is zero, then the timer is disarmed. When you do specify TIMER_TOLERANCE, the tolerance is set from the it_value member.
The timer_settime() function rounds up time values that are between two consecutive nonnegative integer multiples of the resolution of the specified timer to the larger multiple of the resolution.
If the it_interval member of value is nonzero, then it specifies a repeat rate that is added to the timer once the it_value period has expired. Subsequently, the timer is automatically rearmed, causing it to become continuous with a period of it_interval.
If the ovalue parameter isn't NULL, then on return from this function it contains a value representing the previous amount of time left before the timer was to have expired, or zero if the timer was disarmed. The previous interval timer period is also stored in the it_interval member.
The timerid is local to the calling process, and must have been created using timer_create().
Timer tolerance
As a QNX Neutrino extension, if you specify the TIMER_TOLERANCE flag, then:
(QNX Neutrino 7.0.1 or later) In order to set the tolerance to a value between 0 and the clock period, you need to have the PROCMGR_AID_HIGH_RESOLUTION_TIMER ability enabled. For more information, see procmgr_ability().
You can set the tolerance at any time without affecting the active/inactive status of the timer. For more information, see Tolerant and high-resolution timers in the Understanding the Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide.
See timer_create().
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |