blob: e13f44642afa01d76e628045a18c7a03b985f07a [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*
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
15static __inline__ _syscall2(int, __syscall_timer_gettime, kernel_timer_t, ktimerid,
16 void *, value);
17
18/* Get the amount of time left on a timer */
19int timer_gettime(timer_t timerid, struct itimerspec *value)
20{
21 struct timer *kt = (struct timer *)timerid;
22
23 /* Get timeout from the kernel */
24 return __syscall_timer_gettime(kt->ktimerid, value);
25}
26
27#endif