[Git][NTPsec/ntpsec][reflogfix] 3 commits: refclock_nmea: set jitter high on NMEA timeout.
Ian Bruene
gitlab at mg.gitlab.com
Fri Sep 15 21:02:46 UTC 2017
Ian Bruene pushed to branch reflogfix at NTPsec / ntpsec
Commits:
caa305e8 by Gary E. Miller at 2017-09-15T21:00:39Z
refclock_nmea: set jitter high on NMEA timeout.
Then the NMEA comes back, the jitter used to be zero, even though
the initial time from the NMEA is rotten. Part of bug #62.
- - - - -
04bb7054 by Gary E. Miller at 2017-09-15T21:00:39Z
Docs: add tally code to ntpq and ntpmon doc.
- - - - -
8cb192c9 by Ian Bruene at 2017-09-15T21:02:37Z
Attempted fix of trimble logging
- - - - -
3 changed files:
- docs/includes/peerfmt.txt
- ntpd/refclock_nmea.c
- ntpd/refclock_trimble.c
Changes:
=====================================
docs/includes/peerfmt.txt
=====================================
--- a/docs/includes/peerfmt.txt
+++ b/docs/includes/peerfmt.txt
@@ -18,3 +18,17 @@ of the link:decode.html#peer[peer status word]
|+offset+ |offset of server relative to this host
|+jitter+ |jitter
|=======================================================================
+
+The tally code is one of the following:
+[width="80%",cols="10%,90%"]
+|==================================================
+| Code| Description
+| | discarded as not valid
+| +x+ | discarded by intersection algorithm
+| +.+ | discarded by table overflow (not used)
+| +-+ | discarded by the cluster algorithm
+| +++ | included by the combine algorithm
+| +#+ | backup (more than +tos maxclock+ sources)
+| +*+ | system peer
+| +o+ | PPS peer (when the prefer peer is valid)
+|==================================================
=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -1175,6 +1175,8 @@ nmea_poll(
*/
if (pp->coderecv == pp->codeproc) {
refclock_report(peer, CEVNT_TIMEOUT);
+ /* reset the jitter, to avoid bad time on recovery */
+ peer->jitter = LOGTOD(PRECISION);
} else {
pp->polls++;
pp->lastref = pp->lastrec;
=====================================
ntpd/refclock_trimble.c
=====================================
--- a/ntpd/refclock_trimble.c
+++ b/ntpd/refclock_trimble.c
@@ -369,34 +369,44 @@ trimble_start (
struct trimble_unit *up;
struct refclockproc *pp;
int fd;
- char gpsdev[20];
+ char device[20];
struct termios tio;
struct calendar build_date;
+ int rcode;
- snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit);
+ snprintf(device, sizeof(device), DEVICE, unit);
/*
* Open serial port.
*/
- fd = refclock_open(peer->cfg.path ? peer->cfg.path : gpsdev,
- peer->cfg.baud ? peer->cfg.baud : SPEED232,
- LDISC_RAW);
- if (fd <= 0) {
-#ifdef DEBUG
- printf("Trimble(%d) start: open %s failed\n", unit, gpsdev);
-#endif
+ if ( !peer->cfg.path ) {
+ /* build a path */
+ rcode = snprintf(device, sizeof(device), DEVICE, unit);
+ if ( 0 > rcode ) {
+ /* failed, set to NUL */
+ device[0] = '\0';
+ }
+ peer->cfg.path = estrdup( device );
+ }
+ fd = refclock_open(peer->cfg.path,
+ peer->cfg.baud ? peer->cfg.baud : SPEED232,
+ LDISC_RAW);
+ if (0 > fd) {
+ msyslog(LOG_ERR, "REFCLOCK: %s Trimble device open(%s) failed",
+ refclock_name(peer), peer->cfg.path);
/* coverity[leaked_handle] */
return false;
}
- msyslog(LOG_NOTICE, "Trimble(%d) fd: %d dev: %s", unit, fd,
- gpsdev);
+ LOGIF(CLOCKINFO, (LOG_NOTICE, "%s open at %s",
+ refclock_name(peer), peer->cfg.path));
if (tcgetattr(fd, &tio) < 0) {
msyslog(LOG_ERR,
- "REFCLOCK: Trimble(%d) tcgetattr(fd, &tio): %m",unit);
+ "REFCLOCK: %s tcgetattr(fd, &tio): %m",
+ refclock_name(peer));
#ifdef DEBUG
- printf("Trimble(%d) tcgetattr(fd, &tio)\n",unit);
+ printf("%s tcgetattr(fd, &tio)\n", refclock_name(peer));
#endif
close(fd);
return false;
@@ -416,26 +426,28 @@ trimble_start (
/* Normal mode, do nothing */
break;
case CLK_PRAECIS:
- msyslog(LOG_NOTICE, "REFCLOCK: Trimble(%d) Praecis mode enabled"
- ,unit);
+ msyslog(LOG_NOTICE, "REFCLOCK: %s Praecis mode enabled",
+ refclock_name(peer));
break;
case CLK_THUNDERBOLT:
- msyslog(LOG_NOTICE, "REFCLOCK: Trimble(%d) Thunderbolt mode enabled"
- ,unit);
+ msyslog(LOG_NOTICE, "REFCLOCK: %s Thunderbolt mode enabled",
+ refclock_name(peer));
tio.c_cflag = (CS8|CLOCAL|CREAD);
break;
case CLK_ACUTIME:
- msyslog(LOG_NOTICE, "REFCLOCK: Trimble(%d) Acutime Gold mode enabled"
- ,unit);
+ msyslog(LOG_NOTICE, "REFCLOCK: %s Acutime Gold mode enabled",
+ refclock_name(peer));
break;
default:
- msyslog(LOG_NOTICE, "REFCLOCK: Trimble(%d) mode unknown",unit);
+ msyslog(LOG_NOTICE, "REFCLOCK: %s mode unknown",
+ refclock_name(peer));
break;
}
if (tcsetattr(fd, TCSANOW, &tio) == -1) {
- msyslog(LOG_ERR, "REFCLOCK: Trimble(%d) tcsetattr(fd, &tio): %m",unit);
+ msyslog(LOG_ERR, "REFCLOCK: %s tcsetattr(fd, &tio): %m",
+ refclock_name(peer));
#ifdef DEBUG
- printf("Trimble(%d) tcsetattr(fd, &tio)\n",unit);
+ printf("%s tcsetattr(fd, &tio)\n",refclock_name(peer));
#endif
close(fd);
free(up);
@@ -449,7 +461,7 @@ trimble_start (
pp->io.fd = fd;
if (!io_addclock(&pp->io)) {
#ifdef DEBUG
- printf("Trimble(%d) io_addclock\n",unit);
+ printf("%s io_addclock\n", refclock_name(peer));
#endif
close(fd);
pp->io.fd = -1;
@@ -482,8 +494,9 @@ trimble_start (
up->build_week = 0;
}
if (up->build_week < MIN_BUILD_GPSWEEK || up->build_week > MAX_BUILD_GPSWEEK) {
- msyslog(LOG_ERR, "REFCLOCK: Trimble(%d) ntpcal_get_build_date() failed: %u",
- unit, up->build_week);
+ msyslog(LOG_ERR,
+ "REFCLOCK: %s ntpcal_get_build_date() failed: %u",
+ refclock_name(peer), up->build_week);
close(fd);
pp->io.fd = -1;
free(up);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/8e28ff6b4bc62a255bfb87fe3715aa75292d357f...8cb192c9a09cbbaa3fbe89dac6b9fb73f030d32d
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/8e28ff6b4bc62a255bfb87fe3715aa75292d357f...8cb192c9a09cbbaa3fbe89dac6b9fb73f030d32d
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170915/c54801f2/attachment.html>
More information about the vc
mailing list