Lines Matching +full:error +full:- +full:correction
8 * a sub-second accuracy bug documented in SR 5003462838 which prevents ntpd
10 * implementation as used by ntpd has a side-effect of screwing up the hardware
18 * The one-time clock adjustment functionality of ntpdate and ntp_timeset can
47 /* Adjustment required. Convert delta to 64-bit microseconds. */
48 big_sec = (long)delta->tv_sec;
49 big_usec = delta->tv_usec;
55 /* Determine how much of a previous correction (if any) we're interrupting. */
77 pdc_usecs_wanted = get_time() - offset_usecs;
80 /* Force new PDC time by starting an extra correction. */
81 set_time_correction(pdc_usecs_wanted - pdc_usecs_current,0,1);
86 gradual MPE time correction slew. */
93 /* Caller wants to know remaining amount of previous correction. */
94 (long)olddelta->tv_sec = prev_correction / 1000000LL;
95 olddelta->tv_usec = prev_correction % 1000000LL;
105 /* Hewlett-Packard Laboratories. */
136 #define abs(x) ((x) < 0 ? -(x) : (x))
149 * clear_adjtime - reset accumulator and threshold variables
159 * adjtime - hp-ux copout of the standard Unix adjtime() system call
172 if (delta->tv_sec) {
186 saveup += delta->tv_usec;
194 adjthresh -= ADJ_DELTA;
198 * While nobody uses it, return the residual before correction,
202 olddelta->tv_sec = olddelta->tv_usec = 0;
207 * _adjtime - does the actual work
224 if ((mqid = msgget(KEY, 0)) == -1)
225 return (-1);
226 msgp->msgb.mtype = CLIENT;
227 msgp->msgb.tv = *delta;
229 msgp->msgb.code = DELTA2;
231 msgp->msgb.code = DELTA1;
235 * fanatic error checking here.
237 if (msgsnd(mqid, &msgp->msgp, MSGSIZE, 0) == -1)
238 return (-1);
240 if (msgrcv(mqid, &msgp->msgp, MSGSIZE, SERVER, 0) == -1)
241 return (-1);
242 *olddelta = msgp->msgb.tv;
257 * Time correction slew is limited to reasonable value.
266 * Time correction slew limit. QNX is a hard real-time system,
273 * execution period (1s). If slightly less than 1s (0.95-0.99), then olddelta
274 * residual error (introduced by execution period jitter) will be reduced.
290 delta_nsec = 1e9 * (long)delta->tv_sec + 1e3 * delta->tv_usec;
311 delta_nsec = -delta_nsec;
317 if (ClockPeriod (CLOCK_REALTIME, 0, &period, 0) == -1)
318 return -1;
325 /* Reduce relative error */
328 increment = 1 + (long)((delta_nsec - 1) / count);
340 /* Reduce relative error */
343 count = 1 + (long)((delta_nsec - 1) / increment);
348 adj.tick_nsec_inc = isneg ? -increment : increment;
357 if (ClockAdjust (CLOCK_REALTIME, &adj, &oldadj) == -1)
358 return -1;
368 /* Reduce rounding error */
369 delta_nsec_old += (delta_nsec_old < 0) ? -500 : 500;
370 olddelta->tv_sec = delta_nsec_old / 1e9;
371 olddelta->tv_usec = (long)(delta_nsec_old - 1e9
372 * (long)olddelta->tv_sec) / 1000;
376 olddelta->tv_sec = 0;
377 olddelta->tv_usec = 0;