]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug 1050] Change ONCORE log message for leap second announcement to avoid misunderst...
authorJuergen Perlinger <perlinger@ntp.org>
Fri, 25 Oct 2013 16:32:28 +0000 (18:32 +0200)
committerJuergen Perlinger <perlinger@ntp.org>
Fri, 25 Oct 2013 16:32:28 +0000 (18:32 +0200)
bk: 526a9d1cPiy81JAgmx7R4epVuS25JQ

ChangeLog
ntpd/refclock_oncore.c

index 88b11e97d948ef68242aaab103c3860bf4061207..4ca05af5e8d713678e3367218fa8424b3ff57b24 100644 (file)
--- 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 <stenn@ntp.org>
 * [Bug 2272] Use C99 integer types. ntp_calendar.h and ntp_types.h .
 (4.2.7p392) 2013/10/15 Released by Harlan Stenn <stenn@ntp.org>
index 7faf7d74aaa0ece66e012bcda41293448ccdff65..b6e7a40b6cd73c5fb3371cc8c64a8ea5afbd1198 100644 (file)
@@ -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 */