Skip to content

Commit 3705a58

Browse files
authored
Call timer() in timer_settime.c only if it exists
1 parent 77e06c9 commit 3705a58

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

lib/timer_settime.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int timer_settime(timer_t timerid CK_ATTRIBUTE_UNUSED,
2525
const struct itimerspec *new_value,
2626
struct itimerspec *old_value CK_ATTRIBUTE_UNUSED)
2727
{
28-
#ifdef HAVE_SETITIMER
28+
#if defined(HAVE_SETITIMER)
2929
/*
3030
* If the system does not have timer_settime() but does have
3131
* setitimer() use that instead of alarm().
@@ -38,7 +38,7 @@ int timer_settime(timer_t timerid CK_ATTRIBUTE_UNUSED,
3838
interval.it_interval.tv_usec = new_value->it_interval.tv_nsec / 1000;
3939

4040
return setitimer(ITIMER_REAL, &interval, NULL);
41-
#else
41+
#elif defined(HAVE_TIMER)
4242
int seconds = new_value->it_value.tv_sec;
4343

4444
/*
@@ -53,5 +53,9 @@ int timer_settime(timer_t timerid CK_ATTRIBUTE_UNUSED,
5353
alarm(seconds);
5454

5555
return 0;
56+
#else
57+
/*
58+
* There is no support for timers on the platform.
59+
*/
5660
#endif
5761
}

0 commit comments

Comments
 (0)