6 #define IS32BIT(x) !((x)+0x80000000ULL>>32)
11 long long offset, freq, maxerror, esterror;
14 long long constant, precision, tolerance;
15 long long time_sec, time_usec;
16 long long tick, ppsfreq, jitter;
19 long long stabil, jitcnt, calcnt, errcnt, stbcnt;
26 long offset, freq, maxerror, esterror;
28 long constant, precision, tolerance;
29 long time_sec, time_usec;
30 long tick, ppsfreq, jitter;
32 long stabil, jitcnt, calcnt, errcnt, stbcnt;
37 int clock_adjtime (clockid_t clock_id, struct timex *utx)
40 #ifdef SYS_clock_adjtime64
42 struct ktimex64 ktx = {
44 .offset = utx->offset,
46 .maxerror = utx->maxerror,
47 .esterror = utx->esterror,
48 .status = utx->status,
49 .constant = utx->constant,
50 .precision = utx->precision,
51 .tolerance = utx->tolerance,
52 .time_sec = utx->time.tv_sec,
53 .time_usec = utx->time.tv_usec,
55 .ppsfreq = utx->ppsfreq,
56 .jitter = utx->jitter,
58 .stabil = utx->stabil,
59 .jitcnt = utx->jitcnt,
60 .calcnt = utx->calcnt,
61 .errcnt = utx->errcnt,
62 .stbcnt = utx->stbcnt,
65 r = __syscall(SYS_clock_adjtime64, clock_id, &ktx);
67 utx->modes = ktx.modes;
68 utx->offset = ktx.offset;
70 utx->maxerror = ktx.maxerror;
71 utx->esterror = ktx.esterror;
72 utx->status = ktx.status;
73 utx->constant = ktx.constant;
74 utx->precision = ktx.precision;
75 utx->tolerance = ktx.tolerance;
76 utx->time.tv_sec = ktx.time_sec;
77 utx->time.tv_usec = ktx.time_usec;
79 utx->ppsfreq = ktx.ppsfreq;
80 utx->jitter = ktx.jitter;
81 utx->shift = ktx.shift;
82 utx->stabil = ktx.stabil;
83 utx->jitcnt = ktx.jitcnt;
84 utx->calcnt = ktx.calcnt;
85 utx->errcnt = ktx.errcnt;
86 utx->stbcnt = ktx.stbcnt;
90 if (SYS_clock_adjtime == SYS_clock_adjtime64 || r!=-ENOSYS)
91 return __syscall_ret(r);
92 if ((utx->modes & ADJ_SETOFFSET) && !IS32BIT(utx->time.tv_sec))
93 return __syscall_ret(-ENOTSUP);
95 if (sizeof(time_t) > sizeof(long)) {
98 .offset = utx->offset,
100 .maxerror = utx->maxerror,
101 .esterror = utx->esterror,
102 .status = utx->status,
103 .constant = utx->constant,
104 .precision = utx->precision,
105 .tolerance = utx->tolerance,
106 .time_sec = utx->time.tv_sec,
107 .time_usec = utx->time.tv_usec,
109 .ppsfreq = utx->ppsfreq,
110 .jitter = utx->jitter,
112 .stabil = utx->stabil,
113 .jitcnt = utx->jitcnt,
114 .calcnt = utx->calcnt,
115 .errcnt = utx->errcnt,
116 .stbcnt = utx->stbcnt,
120 if (clock_id==CLOCK_REALTIME) r = __syscall(SYS_adjtimex, &ktx);
123 r = __syscall(SYS_clock_adjtime, clock_id, &ktx);
125 utx->modes = ktx.modes;
126 utx->offset = ktx.offset;
127 utx->freq = ktx.freq;
128 utx->maxerror = ktx.maxerror;
129 utx->esterror = ktx.esterror;
130 utx->status = ktx.status;
131 utx->constant = ktx.constant;
132 utx->precision = ktx.precision;
133 utx->tolerance = ktx.tolerance;
134 utx->time.tv_sec = ktx.time_sec;
135 utx->time.tv_usec = ktx.time_usec;
136 utx->tick = ktx.tick;
137 utx->ppsfreq = ktx.ppsfreq;
138 utx->jitter = ktx.jitter;
139 utx->shift = ktx.shift;
140 utx->stabil = ktx.stabil;
141 utx->jitcnt = ktx.jitcnt;
142 utx->calcnt = ktx.calcnt;
143 utx->errcnt = ktx.errcnt;
144 utx->stbcnt = ktx.stbcnt;
147 return __syscall_ret(r);
150 if (clock_id==CLOCK_REALTIME) return syscall(SYS_adjtimex, utx);
152 return syscall(SYS_clock_adjtime, clock_id, utx);