summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cpukit/score/src/kern_ntptime.c12
-rw-r--r--cpukit/score/src/kern_tc.c16
2 files changed, 9 insertions, 19 deletions
diff --git a/cpukit/score/src/kern_ntptime.c b/cpukit/score/src/kern_ntptime.c
index 44d56cf59e..c6f70079b3 100644
--- a/cpukit/score/src/kern_ntptime.c
+++ b/cpukit/score/src/kern_ntptime.c
@@ -900,16 +900,10 @@ hardpps(struct timespec *tsp, long delta_nsec)
pps_tf[0].tv_nsec = u_nsec;
/*
- * Compute the difference between the current and previous
- * counter values. If the difference exceeds 0.5 s, assume it
- * has wrapped around, so correct 1.0 s.
+ * Update the frequency accumulator using the difference between the
+ * current and previous PPS event measured directly by the timecounter.
*/
- u_nsec = delta_nsec;
- if (u_nsec > (NANOSECOND >> 1))
- u_nsec -= NANOSECOND;
- else if (u_nsec < -(NANOSECOND >> 1))
- u_nsec += NANOSECOND;
- pps_fcount += u_nsec;
+ pps_fcount += delta_nsec - NANOSECOND;
if (v_nsec > MAXFREQ || v_nsec < -MAXFREQ)
goto out;
time_status &= ~STA_PPSJITTER;
diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 5e43964bf4..0aa0fdd393 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -2161,7 +2161,7 @@ pps_event(struct pps_state *pps, int event)
struct timecounter *captc;
uint64_t capth_scale;
struct bintime bt;
- struct timespec ts, *tsp, *osp;
+ struct timespec *tsp, *osp;
uint32_t tcount, *pcount;
int foff;
pps_seq_t *pseq;
@@ -2265,7 +2265,7 @@ pps_event(struct pps_state *pps, int event)
#ifdef PPS_SYNC
if (fhard) {
- uint64_t scale;
+ uint64_t delta_nsec;
/*
* Feed the NTP PLL/FLL.
@@ -2275,14 +2275,10 @@ pps_event(struct pps_state *pps, int event)
tcount = pps->capcount - pps->ppscount[2];
pps->ppscount[2] = pps->capcount;
tcount &= captc->tc_counter_mask;
- scale = (uint64_t)1 << 63;
- scale /= captc->tc_frequency;
- scale *= 2;
- bt.sec = 0;
- bt.frac = 0;
- bintime_addx(&bt, scale * tcount);
- bintime2timespec(&bt, &ts);
- hardpps(tsp, ts.tv_nsec + 1000000000 * ts.tv_sec);
+ delta_nsec = 1000000000;
+ delta_nsec *= tcount;
+ delta_nsec /= captc->tc_frequency;
+ hardpps(tsp, (long)delta_nsec);
}
#endif