1 /* Copyright (C) 2013 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <http://www.gnu.org/licenses/>. */
22 #include <libc-internal.h>
26 int __syscall_clock_getres(clockid_t clock_id
, struct timespec
*tp
);
27 libc_hidden_proto (__syscall_clock_getres
)
29 int __syscall_clock_gettime(clockid_t clock_id
, struct timespec
*tp
);
30 libc_hidden_proto (__syscall_clock_gettime
)
32 /* Get resolution of clock. */
34 __clock_getres (clockid_t clock_id
, struct timespec
*tp
)
36 /* we could try to provide fallback
37 via ??? for CLOCK_REALTIME
38 via HP_TIMING for CLOCK_PROCESS_CPUTIME_ID,
39 CLOCK_THREAD_CPUTIME_ID and related timers
41 for now just pass it to kernel
43 /* the negative clock_id means a CPU-timer, the resolution is same for all of them
44 the kernel returns resolution regardless whether the timer is accessible,
45 but POSIX/testsuite expects EINVAL
51 /* we reuse user provided struct timespec */
52 rv
= INLINE_SYSCALL (clock_gettime
, 2, clock_id
, tp
);
55 /* valid, now really get the resolution */
58 return INLINE_SYSCALL (clock_getres
, 2, clock_id
, tp
);
60 strong_alias (__clock_getres
, clock_getres
)