OSDN Git Service

Patch from Paul Mundt (lethal) adding an initial librt implementation.
[uclinux-h8/uClibc.git] / librt / timer_gettime.c
1 /*
2  * timer_gettime.c - get the timer value.
3  */
4
5 #include <errno.h>
6 #include <stdlib.h>
7 #include <time.h>
8 #include <sys/syscall.h>
9
10 #include "kernel-posix-timers.h"
11
12 #ifdef __NR_timer_gettime
13
14 #define __NR___syscall_timer_gettime __NR_timer_gettime
15 static inline _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid, void *, value);
16
17 /* Get the amount of time left on a timer */
18 int timer_gettime(timer_t timerid, struct itimerspec *value)
19 {
20     struct timer *kt = (struct timer *) timerid;
21
22     /* Get timeout from the kernel */
23     return __syscall_timer_gettime(kt->ktimerid, value);
24 }
25
26 #endif