From: Harlan Stenn Date: Sat, 16 Oct 1999 05:12:07 +0000 (-0000) Subject: ChangeLog, ntp_refclock.c, refclock_atom.c, refclock_oncore.c: X-Git-Tag: NTP_4_98_c~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80e7356048e8d5fa2eef02ad3513ae4b3f9d2e93;p=thirdparty%2Fntp.git ChangeLog, ntp_refclock.c, refclock_atom.c, refclock_oncore.c: * ntpd/refclock_oncore.c: * ntpd/refclock_atom.c: * ntpd/ntp_refclock.c: PPS cleanup From: John.Hay@mikom.csir.co.za ChangeLog, dcfd.c: * parseutil/dcfd.c: abs() -> l_abs(), time.h (AIX 4.3.2 patches) From: Dana Kaempen bk: 38080927olmI16Wujv2G3Fewe7V5UQ --- diff --git a/ChangeLog b/ChangeLog index 8d810d612d..3bcf1b6ca8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 1999-10-16 Harlan Stenn + * parseutil/dcfd.c: abs() -> l_abs(), time.h (AIX 4.3.2 patches) + From: Dana Kaempen + + * ntpd/refclock_oncore.c: + * ntpd/refclock_atom.c: + * ntpd/ntp_refclock.c: + PPS cleanup + From: John.Hay@mikom.csir.co.za + * util/ntptime.c: * ntpdate/ntptimeset.c: * ntpdate/ntpdate.c: diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index a9b1e91f0a..4853b75f50 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -621,7 +621,7 @@ refclock_gtlin( #endif #ifdef HAVE_PPSAPI pps_info_t pi; - struct timespec *tsp; + struct timespec timeout, *tsp; double a; #endif @@ -637,7 +637,10 @@ refclock_gtlin( trtmp = rbufp->recv_time; #ifdef HAVE_PPSAPI - if (rbufp->fd == fdpps && time_pps_fetch(fdpps, 0, &pi, 0) >= 0) { + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + if ((rbufp->fd == fdpps) && + (time_pps_fetch(fdpps, PPS_TSFMT_TSPEC, &pi, &timeout) >= 0)) { if(pps_assert) tsp = &pi.assert_timestamp; else @@ -1145,15 +1148,16 @@ refclock_ioctl( } if (pps_hardpps) { if (pps_assert) - mode |= PPS_CAPTUREASSERT; + mode = PPS_CAPTUREASSERT; else - mode |= PPS_CAPTURECLEAR; - } - if (time_pps_kcbind(fdpps, 0, mode, 0) < 0) { - msyslog(LOG_ERR, - "refclock_ioctl: time_pps_kpcbind failed"); - fdpps = 0; - return (0); + mode = PPS_CAPTURECLEAR; + if (time_pps_kcbind(fdpps, PPS_KC_HARDPPS, mode, + PPS_TSFMT_TSPEC) < 0) { + msyslog(LOG_ERR, + "refclock_ioctl: time_pps_kcbind failed"); + fdpps = 0; + return (0); + } } } #endif /* HAVE_PPSAPI */ diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index 9f95bbe869..b3c756a049 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -258,6 +258,7 @@ atom_pps( register struct atomunit *up; struct refclockproc *pp; #ifdef HAVE_PPSAPI + struct timespec timeout; # ifdef HAVE_TIMESPEC struct timespec ts; # else @@ -296,7 +297,9 @@ atom_pps( i = up->pps_info.assert_sequence; if (fdpps <= 0) return (1); - if (time_pps_fetch(fdpps, 0, &up->pps_info, 0) < 0) + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + if (time_pps_fetch(fdpps, PPS_TSFMT_TSPEC, &up->pps_info, &timeout) < 0) return (1); if (i == up->pps_info.assert_sequence) return (2); diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c index 0b43f1de62..d233724b4d 100644 --- a/ntpd/refclock_oncore.c +++ b/ntpd/refclock_oncore.c @@ -456,14 +456,16 @@ oncore_start( instance->pps_p.clear_offset.tv_sec = 0; instance->pps_p.clear_offset.tv_nsec = 0; } -/* - if (time_pps_setparams(instance->pps_h, &instance->pps_p) < 0) - instance->pps_p.mode &= ~(PPS_HARDPPSONCLEAR|PPS_HARDPPSONASSERT); -*/ + instance->pps_p.mode |= PPS_TSFMT_TSPEC; if (time_pps_setparams(instance->pps_h, &instance->pps_p) < 0) { perror("time_pps_setparams"); exit(1); } + if (time_pps_kcbind(instance->pps_h, PPS_KC_HARDPPS, + instance->pps_p.mode & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR), + PPS_TSFMT_TSPEC) < 0) { + perror("time_pps_kcbind"); + } #endif instance->pp = pp; instance->peer = peer; @@ -1227,6 +1229,7 @@ oncore_msg_En( struct timeval *tsp = 0; #endif #ifdef HAVE_PPSAPI + struct timespec timeout; pps_info_t pps_i; #else /* ! HAVE_PPSAPI */ #ifdef HAVE_CIOGETEV @@ -1256,7 +1259,10 @@ oncore_msg_En( #ifdef HAVE_PPSAPI j = instance->ev_serial; - if (time_pps_fetch(instance->pps_h, 0, &pps_i, 0) < 0) { + timeout.tv_sec = 0; + timeout.tv_nsec = 0; + if (time_pps_fetch(instance->pps_h, PPS_TSFMT_TSPEC, &pps_i, + &timeout) < 0) { printf("ONCORE: time_pps_fetch failed\n"); return; } diff --git a/parseutil/dcfd.c b/parseutil/dcfd.c index 3277c4a232..7d223de3cb 100644 --- a/parseutil/dcfd.c +++ b/parseutil/dcfd.c @@ -36,6 +36,7 @@ #include #include #include +#include /* * NTP compilation environment @@ -200,9 +201,9 @@ typedef struct clocktime clocktime_t; #define TIMES24(_X_) (((_X_) << 4) + ((_X_) << 3)) /* *16 + *8 */ #define TIMES60(_X_) ((((_X_) << 4) - (_X_)) << 2) /* *(16 - 1) *4 */ /* - * generic abs() function + * generic l_abs() function */ -#define abs(_x_) (((_x_) < 0) ? -(_x_) : (_x_)) +#define l_abs(_x_) (((_x_) < 0) ? -(_x_) : (_x_)) /* * conversion related return/error codes @@ -881,9 +882,9 @@ pr_timeval( static char buf[20]; if (val->tv_sec == 0) - sprintf(buf, "%c0.%06ld", (val->tv_usec < 0) ? '-' : '+', (long int)abs(val->tv_usec)); + sprintf(buf, "%c0.%06ld", (val->tv_usec < 0) ? '-' : '+', (long int)l_abs(val->tv_usec)); else - sprintf(buf, "%ld.%06ld", (long int)val->tv_sec, (long int)abs(val->tv_usec)); + sprintf(buf, "%ld.%06ld", (long int)val->tv_sec, (long int)l_abs(val->tv_usec)); return buf; } @@ -985,8 +986,8 @@ update_drift( LPRINTF("update_drift: drift_comp %ld ", (long int)accum_drift); fdrift = (fdrift * 1000) / (1<)) { /* @@ -1806,7 +1807,7 @@ main( (clock_time.flags & DCFB_ANNOUNCE) ? "A" : "_", (clock_time.flags & DCFB_DST) ? "D" : "_", (clock_time.flags & DCFB_LEAP) ? "L" : "_", - (lasterror < 0) ? '-' : '+', abs(lasterror) / 1000000, abs(lasterror) % 1000000 + (lasterror < 0) ? '-' : '+', l_abs(lasterror) / 1000000, l_abs(lasterror) % 1000000 ); if (trace && (i == 0))