[chrony-dev] macOS 10.13 with netbsd driver

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


I stopped chronyd, then advanced the local clock by about 10 seconds. When I restarted chronyd it hit a fatal error with adjtime().

I put this patch in to correct the problem but thought I should discuss with you before submission. I'm wondering if it might be better to patch PRV_AdjustTime so that on macOS we can always handle a NULL argument.

With this patch, the frequency jumped up to 2500 ppm until the local offset was below 1 second. It then dropped back to its usual value and the system converged as normal. 

number9:chrony bryan$ git diff
diff --git a/sys_netbsd.c b/sys_netbsd.c
index ba66b12..226b4eb 100644
--- a/sys_netbsd.c
+++ b/sys_netbsd.c
@@ -84,9 +84,18 @@ get_offset_correction(struct timespec *raw,
 {
   struct timeval remadj;
   double adjustment_remaining;
+#ifdef MACOSX
+  struct timeval t1 = {0, 0};
 
+  if (PRV_AdjustTime(&t1, &remadj) < 0)
+    LOG_FATAL("adjtime() failed");
+
+  if (PRV_AdjustTime(&remadj, NULL) < 0)
+    LOG_FATAL("adjtime() failed");
+#else
   if (PRV_AdjustTime(NULL, &remadj) < 0)
     LOG_FATAL("adjtime() failed");
+#endif
 
   adjustment_remaining = UTI_TimevalToDouble(&remadj);


Bryan Christianson
bryan@xxxxxxxxxxxxx




--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/