Also, use time_alarm() instead of the POSIX alarm() function, because alarm() interferes with time_alarm().