From: Juergen Perlinger Date: Fri, 25 Oct 2013 16:32:28 +0000 (+0200) Subject: [Bug 1050] Change ONCORE log message for leap second announcement to avoid misunderst... X-Git-Tag: NTP_4_2_7P394~1^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6baa78fd834c467a87f0649f07a469569853c33f;p=thirdparty%2Fntp.git [Bug 1050] Change ONCORE log message for leap second announcement to avoid misunderstandings. bk: 526a9d1cPiy81JAgmx7R4epVuS25JQ --- diff --git a/ChangeLog b/ChangeLog index 88b11e97d..4ca05af5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* [Bug 1050] Change ONCORE log message for leap second announcement + to avoid misunderstandings. (4.2.7p393) 2013/10/16 Released by Harlan Stenn * [Bug 2272] Use C99 integer types. ntp_calendar.h and ntp_types.h . (4.2.7p392) 2013/10/15 Released by Harlan Stenn diff --git a/ntpd/refclock_oncore.c b/ntpd/refclock_oncore.c index 7faf7d74a..b6e7a40b6 100644 --- a/ntpd/refclock_oncore.c +++ b/ntpd/refclock_oncore.c @@ -3196,6 +3196,11 @@ oncore_msg_Gj( size_t len ) { + static const char * insrem[2] = { + "removed", + "inserted" + }; + int dt; char *cp; @@ -3213,12 +3218,24 @@ oncore_msg_Gj( (buf[13] + 256 * (buf[12] + 256 * buf[11]))), buf[15], buf[16], buf[17]); + /* There seems to be eternal confusion about when a leap second + * takes place. It's the second *before* the new TAI offset + * becomes effective. But since the ONCORE receiver tells us + * just that, we would have to do some time/date calculations to + * get the actual leap second -- that is, the one that is + * deleted or inserted. + * + * Going through all this for a simple log is probably overkill, + * so for fixing bug#1050 the message output is changed to + * reflect the fact that it tells the second after the leap + * second. + */ if (dt) oncore_log_f(instance, LOG_NOTICE, - "Leap second (%d) scheduled for %d%s%d at %d:%d:%d", - dt, buf[9], months[buf[8] - 1], - 256 * buf[6] + buf[7], buf[15], buf[16], - buf[17]); + "Leap second %s (%d) before %04u-%02u-%02u/%02u:%02u:%02u", + insrem[(dt > 0)], dt, + 256u * buf[6] + buf[7], buf[8], buf[9], + buf[15], buf[16], buf[17]); /* Only raise warning within a month of the leap second */