Lines Matching +full:int +full:- +full:threshold
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
24 int adjtime(struct timeval *delta, struct timeval *olddelta);
26 int adjtime(struct timeval *delta, struct timeval *olddelta)
39 extern long long pdc_time(int *);
40 extern void set_time_correction(long long, int, int);
47 /* Adjustment required. Convert delta to 64-bit microseconds. */
48 big_sec = (long)delta->tv_sec;
49 big_usec = delta->tv_usec;
73 int hpe_status;
77 pdc_usecs_wanted = get_time() - offset_usecs;
81 set_time_correction(pdc_usecs_wanted - pdc_usecs_current,0,1);
94 (long)olddelta->tv_sec = prev_correction / 1000000LL;
95 olddelta->tv_usec = prev_correction % 1000000LL;
105 /* Hewlett-Packard Laboratories. */
121 * Implemented variable threshold to limit age of
136 #define abs(x) ((x) < 0 ? -(x) : (x))
142 #define ADJ_THRESH 200 /* initial threshold */
143 #define ADJ_DELTA 4 /* threshold decrement */
145 static long adjthresh; /* adjustment threshold */
149 * clear_adjtime - reset accumulator and threshold variables
159 * adjtime - hp-ux copout of the standard Unix adjtime() system call
161 int
172 if (delta->tv_sec) {
180 * tripping a threshold, which is initially set at ADJ_THESH and
186 saveup += delta->tv_usec;
194 adjthresh -= ADJ_DELTA;
202 olddelta->tv_sec = olddelta->tv_usec = 0;
207 * _adjtime - does the actual work
209 int
215 register int mqid;
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;
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;
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
278 int
290 delta_nsec = 1e9 * (long)delta->tv_sec + 1e3 * delta->tv_usec;
303 int isneg = 0;
311 delta_nsec = -delta_nsec;
317 if (ClockPeriod (CLOCK_REALTIME, 0, &period, 0) == -1)
318 return -1;
328 increment = 1 + (long)((delta_nsec - 1) / count);
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;
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;