[Git][NTPsec/ntpsec][master] Fix for musl/Alpine not supporting ntp_gettime()
Hal Murray (@hal.murray)
gitlab at mg.gitlab.com
Fri Mar 8 08:54:19 UTC 2024
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
e815d37e by Hal Murray at 2024-03-08T00:39:14-08:00
Fix for musl/Alpine not supporting ntp_gettime()
- - - - -
1 changed file:
- ntpd/refclock_local.c
Changes:
=====================================
ntpd/refclock_local.c
=====================================
@@ -165,10 +165,25 @@ local_poll(
* the leap bits and quality indicators from the kernel.
*/
if (loop_data.lockclock) {
+/* Both ntp_adjtime() and ntp_gettime() return the clock status
+ * which includes leap pending info. See man ntp_adjtime
+ *
+ * Using ntp_gettime() allows putting a breakpoint on ntp_adjtime()
+ * to make sure we don't trash things if somebody else is taking
+ * care of the clock and we are just the server -- lockclock mode.
+ *
+ * Grump. musl doesn't have ntp_gettime()
+ * This kludge seems simpler than hacking waf to not build this driver.
+ */
+#ifdef HAVE_NTP_GETTIME
struct ntptimeval ntv;
- memset(&ntv, 0, sizeof ntv);
- /* status info in return value */
+ ZERO(ntv);
switch (ntp_gettime(&ntv)) {
+#else
+ struct timex ntv;
+ ZERO(ntv);
+ switch (ntp_adjtime(&ntv)) {
+#endif
case TIME_OK:
pp->leap = LEAP_NOWARNING;
peer->stratum = pp->stratum;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/e815d37e60903f1709c522d6d5abaf2a0e581f98
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/e815d37e60903f1709c522d6d5abaf2a0e581f98
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20240308/db348d86/attachment-0001.htm>
More information about the vc
mailing list