diff options
Diffstat (limited to 'src/sysdeps/trytimer.c')
-rw-r--r-- | src/sysdeps/trytimer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/sysdeps/trytimer.c b/src/sysdeps/trytimer.c index 84cea0d..9d6291b 100644 --- a/src/sysdeps/trytimer.c +++ b/src/sysdeps/trytimer.c @@ -1,12 +1,14 @@ /* ISC license. */ -#include <sys/types.h> #include <signal.h> #include <time.h> int main (void) { timer_t blah ; - if (timer_create(CLOCK_REALTIME, 0, &blah) < 0) return 111 ; + struct itimerspec it = { .it_interval = { .tv_sec = 0, .tv_nsec = 0 }, .it_value = { .tv_sec = 1, .tv_nsec = 0 } } ; + struct sigevent se = { .sigev_notify = SIGEV_SIGNAL, .sigev_signo = SIGALRM, .sigev_value = { .sival_int = 0 }, .sigev_notify_function = 0, .sigev_notify_attributes = 0 } ; + if (timer_create(CLOCK_REALTIME, &se, &blah) < 0) return 111 ; + if (timer_settime(blah, TIMER_ABSTIME, &it, 0) < 0) return 111 ; return 0 ; } |