Discussion:
Ntpd log message readably tweak.
Gerald Hanuer
2016-02-07 14:18:46 UTC
Permalink
Hello tech@,

https://marc.info/?l=openbsd-misc&m=145479483809799&w=2
ntpd[9279]: adjusting local clock by 9.096751s
ntpd[9279]: adjusting local clock by 7.971861s
ntpd[9279]: adjusting local clock by 6.838999s
I don't think that clock is adjusted "by" that values.
If that would be the case, I guess clock would be far faster synced.
Wording of the logged messages seems to imply that \
the clock has been adjusted by the displayed number of \
seconds each time the message is printed.

What I beleive is trying to be conveyed to the "sysadmin" \
is, the current offset of the local clock \
relative to the time server.

This is the output with the included patch applied.
ntpd[17167]: adjusting local clock (offset -15.877748s)
ntpd[17167]: adjusting local clock (offset -14.532992s)
ntpd[17167]: adjusting local clock (offset -14.216236s)

The patch takes cues from code else where in ntpd.c
strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %Z %Y",
localtime(&tval));
log_info("set local clock to %s (offset %fs)", buf, d);

This is the output of that existing code.
ntpd[20576]: set local clock to Sun Feb 7 01:38:35 UTC 2016 (offset
-0.262911s)

Regards,
Gerald Hanuer

Index: ntpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.106
diff -u -p -r1.106 ntpd.c
--- ntpd.c 2 Feb 2016 17:51:11 -0000 1.106
+++ ntpd.c 7 Feb 2016 08:52:34 -0000
@@ -443,9 +443,9 @@ ntpd_adjtime(double d)
d += getoffset();
if (d >= (double)LOG_NEGLIGIBLE_ADJTIME / 1000 ||
d <= -1 * (double)LOG_NEGLIGIBLE_ADJTIME / 1000)
- log_info("adjusting local clock by %fs", d);
+ log_info("adjusting local clock (offset %fs)", d);
else
- log_debug("adjusting local clock by %fs", d);
+ log_debug("adjusting local clock (offset %fs)", d);
d_to_tv(d, &tv);
if (adjtime(&tv, &olddelta) == -1)
log_warn("adjtime failed");
Otto Moerbeek
2016-02-08 15:29:22 UTC
Permalink
Post by Gerald Hanuer
https://marc.info/?l=openbsd-misc&m=145479483809799&w=2
ntpd[9279]: adjusting local clock by 9.096751s
ntpd[9279]: adjusting local clock by 7.971861s
ntpd[9279]: adjusting local clock by 6.838999s
I don't think that clock is adjusted "by" that values.
If that would be the case, I guess clock would be far faster synced.
Wording of the logged messages seems to imply that \
the clock has been adjusted by the displayed number of \
seconds each time the message is printed.
What I beleive is trying to be conveyed to the "sysadmin" \
is, the current offset of the local clock \
relative to the time server.
This is the output with the included patch applied.
ntpd[17167]: adjusting local clock (offset -15.877748s)
ntpd[17167]: adjusting local clock (offset -14.532992s)
ntpd[17167]: adjusting local clock (offset -14.216236s)
The patch takes cues from code else where in ntpd.c
strftime(buf, sizeof(buf), "%a %b %e %H:%M:%S %Z %Y",
localtime(&tval));
log_info("set local clock to %s (offset %fs)", buf, d);
This is the output of that existing code.
ntpd[20576]: set local clock to Sun Feb 7 01:38:35 UTC 2016 (offset
-0.262911s)
Regards,
Gerald Hanuer
This has been discussed before. The -ing form here means the action is
"in progress". This is called "progressive aspect" in linguistic
terms.

Adjusting the clock isn't done instantaneously. It's done by speeding
up or slowing down the running of the clock and thus takes a while.
This is different from "setting" the clock.

-Otto
Post by Gerald Hanuer
Index: ntpd.c
===================================================================
RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v
retrieving revision 1.106
diff -u -p -r1.106 ntpd.c
--- ntpd.c 2 Feb 2016 17:51:11 -0000 1.106
+++ ntpd.c 7 Feb 2016 08:52:34 -0000
@@ -443,9 +443,9 @@ ntpd_adjtime(double d)
d += getoffset();
if (d >= (double)LOG_NEGLIGIBLE_ADJTIME / 1000 ||
d <= -1 * (double)LOG_NEGLIGIBLE_ADJTIME / 1000)
- log_info("adjusting local clock by %fs", d);
+ log_info("adjusting local clock (offset %fs)", d);
else
- log_debug("adjusting local clock by %fs", d);
+ log_debug("adjusting local clock (offset %fs)", d);
d_to_tv(d, &tv);
if (adjtime(&tv, &olddelta) == -1)
log_warn("adjtime failed");
Gerald Hanuer
2016-02-08 17:58:30 UTC
Permalink
Hello tech@,

Otto thanks for the clarification.

https://marc.info/?l=openbsd-misc&m=145480059910903&w=2

I had not seen Naddy's comment before firing off the diff.

The explanations given are clear and helpfull.

Regards,
Gerald Hanuer

Loading...