diff options
Diffstat (limited to 'libc/sysdeps/linux/common/clock_getres.c')
| -rw-r--r-- | libc/sysdeps/linux/common/clock_getres.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libc/sysdeps/linux/common/clock_getres.c b/libc/sysdeps/linux/common/clock_getres.c index 8ee782845..0a3e1d16f 100644 --- a/libc/sysdeps/linux/common/clock_getres.c +++ b/libc/sysdeps/linux/common/clock_getres.c @@ -7,7 +7,7 @@ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. */ -#include "syscalls.h" +#include <sys/syscall.h> #include <time.h> #include <unistd.h> @@ -18,15 +18,18 @@ libc_hidden_proto(sysconf) int clock_getres(clockid_t clock_id, struct timespec* res) { - long clk_tck; int retval = -1; switch (clock_id) { case CLOCK_REALTIME: - if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0) - clk_tck = 100; - res->tv_sec = 0; - res->tv_nsec = 1000000000 / clk_tck; + if (res) { + long clk_tck; + + if ((clk_tck = sysconf(_SC_CLK_TCK)) < 0) + clk_tck = 100; + res->tv_sec = 0; + res->tv_nsec = 1000000000 / clk_tck; + } retval = 0; break; |
