[chrony-dev] [RFC PATCH v1 06/17] local: Use auxiliary clock in local.c

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


LCL_ReadRawTime() must target the same clock being disciplined. Add additional initialization code to
read the auxiliary clock ID from the configuration.
---
 local.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/local.c b/local.c
index d3725df..e6c6434 100644
--- a/local.c
+++ b/local.c
@@ -318,6 +318,15 @@ LCL_Initialise(void)
   drv_accrue_offset = NULL;
   drv_offset_convert = NULL;
 
+#if defined(FEAT_AUXCLOCK) && defined(HAVE_CLOCK_GETTIME)
+  {
+    const int *l_clockid;
+
+    l_clockid = CNF_GetAuxClockId();
+    if (l_clockid)
+      clock_id = l_clockid;
+  }
+#endif
   /* This ought to be set from the system driver layer */
   current_freq_ppm = 0.0;
   temp_comp_ppm = 0.0;
@@ -509,6 +518,10 @@ void LCL_RemoveDispersionNotifyHandler(LCL_DispersionNotifyHandler handler, void
 void
 LCL_ReadRawTime(struct timespec *ts)
 {
+  /* Enabling auxiliary clocks depends on HAVE_CLOCK_GETTIME
+     There is no chance that we call gettimeofday() while using
+     auxiliary clocks
+  */
 #if HAVE_CLOCK_GETTIME
   if (clock_gettime(*clock_id, ts) < 0)
     LOG_FATAL("clock_gettime() failed : %s", strerror(errno));
-- 
2.34.1


-- 
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/