iconv: add euro symbol to GBK as single byte 0x80
[musl.git] / src / time / clock_settime.c
blob1004ed15284621129789270d0f97e30c5c462095
1 #include <time.h>
2 #include <errno.h>
3 #include "syscall.h"
5 #define IS32BIT(x) !((x)+0x80000000ULL>>32)
7 int clock_settime(clockid_t clk, const struct timespec *ts)
9 #ifdef SYS_clock_settime64
10 time_t s = ts->tv_sec;
11 long ns = ts->tv_nsec;
12 int r = -ENOSYS;
13 if (SYS_clock_settime == SYS_clock_settime64 || !IS32BIT(s))
14 r = __syscall(SYS_clock_settime64, clk,
15 ((long long[]){s, ns}));
16 if (SYS_clock_settime == SYS_clock_settime64 || r!=-ENOSYS)
17 return __syscall_ret(r);
18 if (!IS32BIT(s))
19 return __syscall_ret(-ENOTSUP);
20 return syscall(SYS_clock_settime, clk, ((long[]){s, ns}));
21 #else
22 return syscall(SYS_clock_settime, clk, ts);
23 #endif