From: Harlan Stenn Date: Wed, 1 Apr 2015 10:44:24 +0000 (+0000) Subject: [Bug 2798] sntp should decode and display the leap indicator X-Git-Tag: NTP_4_3_12~3^2~3^2^2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4991f378cca6986b4895a49f85eda2337c67ac79;p=thirdparty%2Fntp.git [Bug 2798] sntp should decode and display the leap indicator bk: 551bcc08wFTiQOQXAgv02lVVyDeEDg --- diff --git a/ChangeLog b/ChangeLog index ae0be3052..361bd7e0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ --- + +* [Bug 2798] sntp should decode and display the leap indicator. +--- (4.2.8p2-RC1) 2015/03/30 Released by Harlan Stenn * [Bug 1787] DCF77's formerly "antenna" bit is "call bit" since 2003. diff --git a/sntp/main.c b/sntp/main.c index c271c8c45..20e27f0fe 100644 --- a/sntp/main.c +++ b/sntp/main.c @@ -1161,6 +1161,7 @@ handle_pkt( int stratum; char * ref; char * ts_str; + char * leaptxt; double offset; double precision; double synch_distance; @@ -1256,9 +1257,28 @@ handle_pkt( disptxt[0] = '\0'; } - msyslog(LOG_INFO, "%s %+.*f%s %s s%d%s", ts_str, + switch (PKT_LEAP(rpkt->li_vn_mode)) { + case LEAP_NOWARNING: + leaptxt = "no-leap"; + break; + case LEAP_ADDSECOND: + leaptxt = "add-leap"; + break; + case LEAP_DELSECOND: + leaptxt = "del-leap"; + break; + case LEAP_NOTINSYNC: + leaptxt = "unsync"; + break; + default: + leaptxt = "LEAP-ERROR"; + break; + } + + msyslog(LOG_INFO, "%s %+.*f%s %s s%d %s%s", ts_str, digits, offset, disptxt, hostnameaddr(hostname, host), stratum, + leaptxt, (time_adjusted) ? " [excess]" : "");