]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, refclock_atom.c, refclock_oncore.c:
authorHarlan Stenn <stenn@ntp.org>
Thu, 14 Sep 2000 02:14:52 +0000 (02:14 -0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 14 Sep 2000 02:14:52 +0000 (02:14 -0000)
  * ntpd/refclock_oncore.c (oncore_get_timestamp): Prind debug
  messages being aware of HAVE_STRUCT_TIMESPEC.
  * ntpd/refclock_atom.c: Have pps_params tag along in the ppsunit
  structure, where it really belongs.
  (atom_pps): Use PPS_CAPTURE{ASSERT,CLEAR}
  From: Dave Mills.

bk: 39c0349chaZ7k0i9-7IAbNjjrsF47g

ChangeLog
ntpd/refclock_atom.c
ntpd/refclock_oncore.c

index eb44a162957f7206ed565dc9b6b2c7d93021dec0..e15c060f1b709bf16dc38d668761e7ba08293538 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2000-09-13  Harlan Stenn  <stenn@whimsy.udel.edu>
+
+       * ntpd/refclock_oncore.c (oncore_get_timestamp): Prind debug
+       messages being aware of HAVE_STRUCT_TIMESPEC.
+
+       * ntpd/refclock_atom.c: Have pps_params tag along in the ppsunit
+       structure, where it really belongs.
+       (atom_pps): Use PPS_CAPTURE{ASSERT,CLEAR}
+       From: Dave Mills.
+
 2000-09-12  Harlan Stenn  <stenn@whimsy.udel.edu>
 
        * configure.in (ac_cv_var_atom_ok): Cleanup ATOM/PPSAPI stuff...
index eccc65720646ce62962b4eeab3f8bdecb9518c82..e18541651879049a162afc6d3f0a85f5f98d20d0 100644 (file)
@@ -76,8 +76,9 @@ static struct peer *pps_peer; /* atom driver for PPS sources */
 struct ppsunit {
        struct timespec ts;     /* last timestamp */
        int fddev;              /* pps device descriptor */
-       pps_info_t pps_info;    /* pps_info control */
-       pps_handle_t handle;    /* PPSAPI handlebars */
+       pps_params_t pps_params; /* pps parameters */
+       pps_info_t pps_info;    /* last pps data */
+       pps_handle_t handle;    /* pps handlebars */
 };
 #endif /* HAVE_PPSAPI */
 
@@ -117,7 +118,6 @@ atom_start(
        struct refclockproc *pp;
 #ifdef HAVE_PPSAPI
        register struct ppsunit *up;
-       pps_params_t pps;
        int mode, temp;
        pps_handle_t handle;
 #endif /* HAVE_PPSAPI */
@@ -159,7 +159,6 @@ atom_start(
        /*
         * Light up the PPSAPI interface, select edge, enable kernel.
         */
-       memset(&pps, 0, sizeof(pps));
        if (time_pps_create(up->fddev, &handle) < 0) {
                msyslog(LOG_ERR,
                    "refclock_atom: time_pps_create failed: %m");
@@ -170,8 +169,8 @@ atom_start(
                    "refclock_atom: time_pps_getcap failed: %m");
                return (0);
        }
-       pps.mode = mode & PPS_CAPTUREBOTH;
-       if (time_pps_setparams(handle, &pps) < 0) {
+       up->pps_params.mode = mode & PPS_CAPTUREBOTH;
+       if (time_pps_setparams(handle, &up->pps_params) < 0) {
                msyslog(LOG_ERR,
                    "refclock_atom: time_pps_setparams failed: %m");
                return (0);
@@ -188,14 +187,14 @@ atom_start(
                    "refclock_atom: time_pps_kcbind failed: %m");
                return (0);
        }
-       (void)time_pps_getparams(handle, &pps);
+       (void)time_pps_getparams(handle, &up->pps_params);
        up->handle = handle;
 #if DEBUG
        if (debug)
                printf(
                    "refclock_atom: %s handle %d ppsapi vers %d mode 0x%x cap 0x%x\n",
-                   pps_device, up->handle, pps.api_version, pps.mode,
-                   mode);
+                   pps_device, up->handle, up->pps_params.api_version,
+                   up->pps_params.mode, mode);
 #endif
 #endif /* HAVE_PPSAPI */
        return (1);
@@ -266,10 +265,12 @@ atom_pps(
            &up->pps_info, &timeout);
        if (rval < 0 || i == up->pps_info.assert_sequence)
                return (1);
-       if (pps_assert)
+       if (up->pps_info.current_mode & PPS_CAPTUREASSERT)
                ts = up->pps_info.assert_timestamp;
-       else
+       else if (up->pps_info.current_mode & PPS_CAPTURECLEAR)
                ts = up->pps_info.clear_timestamp;
+       else
+               return (1);
        if (ts.tv_sec == up->ts.tv_sec && ts.tv_nsec < up->ts.tv_nsec +
            RANGEGATE)
                return (1);
index 000346663f3241f45dff71daafe26afcf161d7e9..331d138258e78abbcd1e77bb4aaf55d4d031597f 100644 (file)
@@ -2301,10 +2301,17 @@ oncore_get_timestamp(
                tsp = &pps_i.assert_timestamp;
 
                if (debug > 2)
+#ifdef HAVE_STRUCT_TIMESPEC
                        printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%09ld\n",
                            instance->unit,
                            (long)pps_i.assert_sequence, j,
                            (long)tsp->tv_sec, (long)tsp->tv_nsec);
+#else
+                       printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%06ld\n",
+                           instance->unit,
+                           (long)pps_i.assert_sequence, j,
+                           (long)tsp->tv_sec, (long)tsp->tv_usec);
+#endif
 
                if (pps_i.assert_sequence == j) {
                        printf("ONCORE: oncore_get_timestamp, error serial pps\n");
@@ -2315,9 +2322,15 @@ oncore_get_timestamp(
                tsp = &pps_i.clear_timestamp;
 
                if (debug > 2)
+#ifdef HAVE_STRUCT_TIMESPEC
                        printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%09ld\n",
                            instance->unit,
                            pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_nsec);
+#else
+                       printf("ONCORE[%d]: serial/j (%lu, %d) %ld.%06ld\n",
+                           instance->unit,
+                           pps_i.clear_sequence, j, tsp->tv_sec, tsp->tv_usec);
+#endif
 
                if (pps_i.clear_sequence == j) {
                        printf("ONCORE: oncore_get_timestamp, error serial pps\n");