libcheck: port to latest check git
[platform/upstream/gstreamer.git] / libs / gst / check / libcheck / timer_delete.c
1 #include "libcompat.h"
2
3 int
4 timer_delete (timer_t timerid CK_ATTRIBUTE_UNUSED)
5 {
6 #ifdef HAVE_SETITIMER
7   /*
8    * If the system does not have timer_settime() but does have
9    * setitimer() use that instead of alarm().
10    */
11   struct itimerval interval;
12
13   /*
14    * Setting values to '0' results in disabling the running timer.
15    */
16   interval.it_value.tv_sec = 0;
17   interval.it_value.tv_usec = 0;
18   interval.it_interval.tv_sec = 0;
19   interval.it_interval.tv_usec = 0;
20
21   return setitimer (ITIMER_REAL, &interval, NULL);
22 #else
23   /*
24    * There is only one timer, that used by alarm.
25    * Setting alarm(0) will not set a new alarm, and
26    * will kill the previous timer.
27    */
28
29   alarm (0);
30
31   return 0;
32 #endif
33 }