2001-04-21 Harlan Stenn <stenn@whimsy.udel.edu>
+ * ntpd/refclock_nmea.c (nmea_receive): Fixes.
+ From: John Woolner <vk1et@tpg.com.au>
+
* util/ntp-genkeys.c: Declare check_netinfo, don't define it.
From: Jack Bryans <jbryans@csulb.edu>
MAKE_NTP_GENKEYS = @MAKE_NTP_GENKEYS@
MAKE_PARSEKMODULE = @MAKE_PARSEKMODULE@
MAKE_TICKADJ = @MAKE_TICKADJ@
+MAKE_TIMETRIM = @MAKE_TIMETRIM@
OPENSSL = @OPENSSL@
OPENSSL_INC = @OPENSSL_INC@
OPENSSL_LIB = @OPENSSL_LIB@
RSADIR = @RSADIR@
RSAOBJS = @RSAOBJS@
RSAREF = @RSAREF@
+RSASRCS = @RSASRCS@
STRIP = @STRIP@
TESTDCF = @TESTDCF@
U = @U@
pp->lastrec = up->tstamp = rd_tmp;
up->pollcnt = 2;
-#ifdef HAVE_PPSAPI
- /* If the PPSAPI is working, rather use its timestamps. */
- if (nmea_pps(up, &rd_tmp) == 1)
- pp->lastrec = up->tstamp = rd_tmp;
-#endif /* HAVE_PPSAPI */
-
#ifdef DEBUG
if (debug)
printf("nmea: timecode %d %s\n", pp->lencode,
one, two or three digits
*/
pp->msec = 0;
- if ( dp[6] == '.' )
- if ( isdigit(dp[7]) )
- {
- pp->msec = (dp[7]-'0')*100;
- if ( isdigit(dp[8]) )
- {
- pp->msec = pp->msec + (dp[8]-'0')*10;
- if ( isdigit(dp[9]) )
- pp->msec = pp->msec + (dp[9]-'0');
+ if (dp[6] == '.') {
+ if (isdigit(dp[7])) {
+ pp->msec = (dp[7] - '0') * 100;
+ if (isdigit(dp[8])) {
+ pp->msec += (dp[8] - '0') * 10;
+ if (isdigit(dp[9])) {
+ pp->msec += (dp[9] - '0');
+ }
+ }
}
- }
+ }
- if (pp->hour > 23 || pp->minute > 59 || pp->second > 59) {
+ if (pp->hour > 23 || pp->minute > 59 || pp->second > 59
+ || pp->msec > 1000) {
refclock_report(peer, CEVNT_BADTIME);
return;
}
- if (cmdtype==GPRMC)
- {
/*
* Convert date and check values.
*/
+ if (cmdtype==GPRMC) {
dp = field_parse(cp,9);
day = dp[0] - '0';
day = (day * 10) + dp[1] - '0';
pp->day = day;
+#ifdef HAVE_PPSAPI
+ /*
+ * If the PPSAPI is working, rather use its timestamps.
+ * assume that the PPS occurs on the second so blow any msec
+ */
+ if (nmea_pps(up, &rd_tmp) == 1) {
+ pp->lastrec = up->tstamp = rd_tmp;
+ pp->msec = 0;
+ }
+#endif /* HAVE_PPSAPI */
+
/*
* Process the new sample in the median filter and determine the
* reference clock offset and dispersion. We use lastrec as both