summaryrefslogtreecommitdiff
path: root/net/openntpd/files
diff options
context:
space:
mode:
authorChristian Weisgerber <naddy@FreeBSD.org>2015-04-30 15:17:20 +0000
committerChristian Weisgerber <naddy@FreeBSD.org>2015-04-30 15:17:20 +0000
commit655ea3bd7b67e58b555bc1bfdff8070d9f24e3b9 (patch)
treed93b6ebcbed0b23b572d042d2024bcda32263ff9 /net/openntpd/files
parentDisable PCH when compiler is GCC to unbreak builds on 8.x and 9.x (diff)
Clear the timex UNSYNC flag so the RTC receives updates from the
system clock.
Diffstat (limited to 'net/openntpd/files')
-rw-r--r--net/openntpd/files/patch-compat_adjfreq__freebsd.c23
-rw-r--r--net/openntpd/files/patch-src_ntpd.c18
2 files changed, 41 insertions, 0 deletions
diff --git a/net/openntpd/files/patch-compat_adjfreq__freebsd.c b/net/openntpd/files/patch-compat_adjfreq__freebsd.c
new file mode 100644
index 000000000000..e0e881df87fb
--- /dev/null
+++ b/net/openntpd/files/patch-compat_adjfreq__freebsd.c
@@ -0,0 +1,23 @@
+--- compat/adjfreq_freebsd.c.orig 2015-03-12 04:42:13 UTC
++++ compat/adjfreq_freebsd.c
+@@ -57,3 +57,20 @@ adjfreq(const int64_t *freq, int64_t *ol
+
+ return 0;
+ }
++
++/*
++ * The RTC is only updated if the clock is not marked as unsynced.
++ */
++
++void
++update_status(int synced)
++{
++ struct timex txc = { 0 };
++
++ txc.modes = MOD_STATUS;
++ if (!synced)
++ txc.status = STA_UNSYNC;
++ if (ntp_adjtime(&txc) == -1)
++ log_warn("ntp_adjtime (3) failed");
++ return;
++}
diff --git a/net/openntpd/files/patch-src_ntpd.c b/net/openntpd/files/patch-src_ntpd.c
new file mode 100644
index 000000000000..eb4601ab9b86
--- /dev/null
+++ b/net/openntpd/files/patch-src_ntpd.c
@@ -0,0 +1,18 @@
+--- src/ntpd.c.orig 2015-03-25 01:18:56 UTC
++++ src/ntpd.c
+@@ -53,6 +53,7 @@ const char *ctl_lookup_option(char *
+ void show_status_msg(struct imsg *);
+ void show_peer_msg(struct imsg *, int);
+ void show_sensor_msg(struct imsg *, int);
++void update_status(int);
+
+ volatile sig_atomic_t quit = 0;
+ volatile sig_atomic_t reconfig = 0;
+@@ -423,6 +424,7 @@ ntpd_adjtime(double d)
+ else if (!firstadj && olddelta.tv_sec == 0 && olddelta.tv_usec == 0)
+ synced = 1;
+ firstadj = 0;
++ update_status(synced);
+ return (synced);
+ }
+