|
RtSetTimerRelative sets the expiration time and repeat interval on the specified timer.
Syntax
BOOL RtSetTimerRelative( HANDLE hTimer, PLARGE_INTEGER pExpiration, PLARGE_INTEGER pInterval );
Parameters
hTimer
An RTX-specific handle to the timer.
pExpiration
A pointer to a LARGE_INTEGER structure indicating the time for the initial expiration of the timer. Expiration is calculated relative to the current value of the clock associated with the timer at creation. The clock is specified in 100ns units.
pInterval
A pointer to a LARGE_INTEGER structure indicating the amount of time between the first expiration and each successive expiration. The clock is specified in 100ns units. See the comments section below for an explanation of pInterval behavior.
Return Values
TRUE if the function succeeds, FALSE if invalid parameters are specified
Remarks
RtSetTimerRelative sets the relative expiration time and repeat interval for the specified timer. If the repeat interval is non-zero, then after the first expiration, the timer will repeatedly expire at the specified interval. If the repeat interval pointer is NULL, then the timer will expire only once, i.e., it is a "one-shot" timer. Likewise, a non-NULL interval pointer may be passed in, with its value set to zero, for a one-shot timer.
Upon each expiration of the timer, the handling thread is signaled to indicate the expiration, and the specified handling routine is run. The timer signals expirations only on the RTX timer interrupt boundaries. The RTX timer interval will be rounded up to the RTX HAL timer resolution. The highest RTX timer resolution is 1 ms, which can be set in the RTX Properties control panel.
The behavior of the pInterval parameter is as follows: If you set the RTX interval to less than the HAL timer period, RTX will set the interval equal to the HAL timer period. The RTX interval must be a multiple of the HAL Timer period. If you specify an interval that is not a multiple of the HAL Timer period, RTX will force the interval to the closest multiple of the HAL Timer period. Two timers with the same interval as the HAL Timer period will necessarily have the same phase. If you specify an interval that is less than the HAL timer period (default to 100 microseconds), RTX will use the HAL timer period as the RTX interval instead of the interval you specified.
To reset the expiration of a timer that has been previously set, the user must ensure that the timer is not active. That is, it must be either a one-shot timer that has expired, or the user must first cancel the timer with RtCancelTimer.
Requirements
Header | Rtapi.h |
Library | Rtx_Rtss.lib |
See Also: