Modern Unixes tend to implement alarms using the setitimer()
function, which has a higher resolution and more options than the simple
alarm() function. One should generally assume that alarm()
and setitimer(ITIMER_REAL) may be the same underlying timer, and
accessing it both ways may cause confusion.
Itimers can be used to implement either one-shot or repeating signals;
also, there are generally 3 separate timers available:
ITIMER_REAL
SIGALRM signal
ITIMER_VIRTUAL
SIGVTALRM
ITIMER_PROF
SIGPROF signal;
Itimers, however, are not part of many of the standards, despite having
been present since 4.2BSD. The POSIX realtime extensions define some
similar, but different, functions.