2 * clock_settime() for uClibc
4 * Copyright (C) 2005 by Peter Kjellerstedt <pkj@axis.com>
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
10 #include <sys/syscall.h>
14 #if defined(__UCLIBC_USE_TIME64__) && defined(__NR_clock_settime64)
15 #include "internal/time64_helpers.h"
17 int clock_settime(clockid_t clock_id
, const struct timespec
*tp
)
19 return INLINE_SYSCALL(clock_settime64
, 2, clock_id
, TO_TS64_P(tp
));
21 #elif defined(__NR_clock_settime)
22 _syscall2(int, clock_settime
, clockid_t
, clock_id
, const struct timespec
*, tp
)
24 # include <sys/time.h>
26 int clock_settime(clockid_t clock_id
, const struct timespec
* tp
)
31 if (tp
->tv_nsec
< 0 || tp
->tv_nsec
>= 1000000000) {
38 TIMESPEC_TO_TIMEVAL(&tv
, tp
);
39 retval
= settimeofday(&tv
, NULL
);