int setitimer (int which, const struct itimerval *value, struct itimerval *ovalue);
The system provides each process with an interval timers. When the timer expires, a signal is sent to the process, and the timer (potentially) restarts.
A timer value is defined by the itimerval structure. If it_value is non-zero, it indicates the time to the next timer expiration. If it_interval is non-zero, it specifies a value to be used in reloading it_value when the timer expires. Setting it_value to 0 disables a timer, regardless of the value of it_interval. Setting it_interval to 0 disables a timer after its next expiration (assuming it_value is non-zero).
Timers never expire before the requested time, dependent on the system timer resolution. Upon expiration, a signal is generated and the timer reset. If the timer expires while the process is active, the signal is delivered immediately when generated.
Is the timer value to set. Must be ITIMER_REAL which decrements in real time, and delivers SIGALRM upon expiration.
Points to a itimerval structure containing timer value to be set.
Points to a itimerval structure to hold old timer value.
On success, zero is returned. On error, -1 is returned, and errno is set as follows:
value or ovalue are not valid pointers
which is not one of ITIMER_REAL, ITIMER_VIRTUAL, or ITIMER_PROF
which is ITIMER_VIRTUAL or ITIMER_PROF
UNIX 98, with exceptions.
The NuTCRACKER Platform supports the semantics of ITIMER_REAL, but not ITIMER_VIRTUAL or ITIMER_PROF. Calls using either of these unsupported timers return -1 and set errno to ENOSYS.
On 2012/8.1/2012R2/10/2016/2019, waitable timers with 100-nanosecond resolution are available,
The timers can be configured to wake the system from a suspended power conservation mode
when the timer expires. See
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.