From: Martin Burnicki Date: Wed, 25 Mar 2015 16:32:25 +0000 (+0100) Subject: [Bug 2592] Account for PPS sources which can provide an accurate absolute time stamp... X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e0c3cd97a145d347c3e3219e9ae94f723365851;p=thirdparty%2Fntp.git [Bug 2592] Account for PPS sources which can provide an accurate absolute time stamp, and status information. bk: 5512e319F4iR9HuSJk_19lXpCkTxZw --- diff --git a/ChangeLog b/ChangeLog index 4b6208782..c8b116987 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ --- +* [Bug 2592] Account for PPS sources which can provide an accurate + absolute time stamp, and status information. Fixed indention and removed trailing whitespace. * [Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003. * [Bug 2728] See if C99-style structure initialization works. diff --git a/include/ntp.h b/include/ntp.h index 428194747..4ffc35f6f 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -435,7 +435,7 @@ struct peer { #define STRATUM_UNSPEC ((u_char)16) /* unspecified */ /* - * Values for peer.flags + * Values for peer.flags (u_int) */ #define FLAG_CONFIG 0x0001 /* association was configured */ #define FLAG_PREEMPT 0x0002 /* preemptable association */ @@ -455,6 +455,7 @@ struct peer { #ifdef OPENSSL # define FLAG_ASSOC 0x8000 /* autokey request */ #endif /* OPENSSL */ +#define FLAG_TSTAMP_PPS 0x10000 /* PPS source provides absolute timestamp */ /* * Definitions for the clear() routine. We use memset() to clear diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index e8b1415f4..a1733944a 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -2661,7 +2661,8 @@ clock_select(void) if (peer->flags & FLAG_PPS) { if (typepps == NULL) typepps = peer; - continue; + if (!(peer->flags & FLAG_TSTAMP_PPS)) + continue; } #endif /* REFCLOCK */ diff --git a/ntpd/refclock_parse.c b/ntpd/refclock_parse.c index 8db7677c9..195ec39cb 100644 --- a/ntpd/refclock_parse.c +++ b/ntpd/refclock_parse.c @@ -4192,13 +4192,13 @@ parse_process( */ if (PARSE_PPS(parsetime->parse_state) && CLK_PPS(parse->peer)) { - parse->peer->flags |= FLAG_PPS; + parse->peer->flags |= (FLAG_PPS | FLAG_TSTAMP_PPS); parse_hardpps(parse, PARSE_HARDPPS_ENABLE); } #endif } else { parse_hardpps(parse, PARSE_HARDPPS_DISABLE); - parse->peer->flags &= ~FLAG_PPS; + parse->peer->flags &= ~(FLAG_PPS | FLAG_TSTAMP_PPS); } /*