]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, ntp_refclock.c, refclock_atom.c, refclock_oncore.c:
authorHarlan Stenn <stenn@ntp.org>
Sat, 16 Oct 1999 05:12:07 +0000 (05:12 -0000)
committerHarlan Stenn <stenn@ntp.org>
Sat, 16 Oct 1999 05:12:07 +0000 (05:12 -0000)
  * 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 <decay@flash.net>

bk: 38080927olmI16Wujv2G3Fewe7V5UQ

ChangeLog
ntpd/ntp_refclock.c
ntpd/refclock_atom.c
ntpd/refclock_oncore.c
parseutil/dcfd.c

index 8d810d612dcc856e1da4eb2ae654b9bc26f32db0..3bcf1b6ca84ea66562fd09e9d81ba9ca764235ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 1999-10-16  Harlan Stenn  <stenn@whimsy.udel.edu>
 
+       * parseutil/dcfd.c:  abs() -> l_abs(), time.h (AIX 4.3.2 patches)
+       From: Dana Kaempen <decay@flash.net>
+
+       * 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: 
index a9b1e91f0a9bb3b7d7a72003dbe42b6b0a0b9b4d..4853b75f50142072558e87beebcea11441a28079 100644 (file)
@@ -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 */
index 9f95bbe86999d8e8dbe6eccb07b62d899b205c6d..b3c756a049ce8adef8f55612fbdf864d6884c564 100644 (file)
@@ -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);
index 0b43f1de62e227cb9106bd748012d423cb8f0143..d233724b4deb0c09afc49cabf2095d0749e9b74d 100644 (file)
@@ -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;
        }
index 3277c4a232171664f0b53f75bed22ef0642c22a1..7d223de3cbbdce29cfba033e40206abcc558c5ad 100644 (file)
@@ -36,6 +36,7 @@
 #include <sys/time.h>
 #include <signal.h>
 #include <syslog.h>
+#include <time.h>
 
 /*
  * 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<<USECSCALE);
                fprintf(df, "%4d.%03d %c%ld.%06ld %.24s\n", idrift, fdrift,
-                       (offset < 0) ? '-' : '+', (long int)(abs(offset) / 1000000),
-                       (long int)(abs(offset) % 1000000), asctime(localtime(&reftime)));
+                       (offset < 0) ? '-' : '+', (long int)(l_abs(offset) / 1000000),
+                       (long int)(l_abs(offset) % 1000000), asctime(localtime(&reftime)));
                fclose(df);
                LPRINTF("update_drift: %d.%03d ppm ", idrift, fdrift);
        }
@@ -1017,8 +1018,8 @@ adjust_clock(
        }
 
        toffset = *offset;
-       toffset.tv_sec  = abs(toffset.tv_sec);
-       toffset.tv_usec = abs(toffset.tv_usec);
+       toffset.tv_sec  = l_abs(toffset.tv_sec);
+       toffset.tv_usec = l_abs(toffset.tv_usec);
        if (timercmp(&toffset, &max_adj_offset, >))
        {
                /*
@@ -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))