trytimer.c (535B)
1 /* ISC license. */ 2 3 #include <signal.h> 4 #include <time.h> 5 6 int main (void) 7 { 8 timer_t blah ; 9 struct itimerspec it = { .it_interval = { .tv_sec = 0, .tv_nsec = 0 }, .it_value = { .tv_sec = 1, .tv_nsec = 0 } } ; 10 struct sigevent se = { .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, .sigev_value = { .sival_int = 0 }, .sigev_notify_function = 0, .sigev_notify_attributes = 0 } ; 11 if (timer_create(CLOCK_REALTIME, &se, &blah) < 0) return 111 ; 12 if (timer_settime(blah, TIMER_ABSTIME, &it, 0) < 0) return 111 ; 13 return 0 ; 14 }