POSIXTimers
POSIX timers are a portable API defined by the POSIX real-time extensions that enable a process to create and manage timers that deliver asynchronous notifications when they expire. A timer is created with timer_create, which associates the timer with a clock (for example CLOCK_REALTIME or CLOCK_MONOTONIC) and a notification method described by a struct sigevent. The timer is referenced by a timer_t handle and controlled with timer_settime, timer_gettime, and timer_delete.
The timing and repetition are described by an itimerspec structure, containing it_value (initial expiration) and it_interval
Notification methods are specified in the sigevent object. The common choice is SIGEV_SIGNAL, which sends a
Clocks determine how time is measured. CLOCK_REALTIME follows wall clock time; CLOCK_MONOTONIC measures time since an
POSIX timers are used for timeouts, periodic tasks, and precise scheduling in real-time and application software.