]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
refclock: set default precision to precision of system clock
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 16 Jun 2017 11:39:01 +0000 (13:39 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 27 Jun 2017 13:29:01 +0000 (15:29 +0200)
doc/chrony.conf.adoc
refclock.c

index 9a20e561b8c391f032ec7c5619b7f728bc01918f..c9cd9a40ed14f39fdf6891ad08ef93a0027f0f10 100644 (file)
@@ -505,9 +505,8 @@ algorithm. Increasing the delay is useful to avoid having no majority in the
 source selection or to make it prefer other sources. The default is 1e-9 (1
 nanosecond).
 *precision* _precision_:::
-This option sets the refclock precision (in seconds). The default is 1e-6 (1
-microsecond) for SHM refclock, and 1e-9 (1 nanosecond) for SOCK, PPS and PHC
-refclocks.
+This option sets the precision of the reference clock (in seconds). The default
+value is the estimated precision of the system clock.
 *maxdispersion* _dispersion_:::
 Maximum allowed dispersion for filtered samples (in seconds). Samples with
 larger estimated dispersion are ignored. By default, this limit is disabled.
index e89b4851b0133fe6e69bf24d18bcea896f562159..6959e5b82fb4e5218658143e6c0caa9584d8fec8 100644 (file)
@@ -173,16 +173,12 @@ RCL_AddRefclock(RefclockParameters *params)
 
   if (strcmp(params->driver_name, "SHM") == 0) {
     inst->driver = &RCL_SHM_driver;
-    inst->precision = 1e-6;
   } else if (strcmp(params->driver_name, "SOCK") == 0) {
     inst->driver = &RCL_SOCK_driver;
-    inst->precision = 1e-9;
   } else if (strcmp(params->driver_name, "PPS") == 0) {
     inst->driver = &RCL_PPS_driver;
-    inst->precision = 1e-9;
   } else if (strcmp(params->driver_name, "PHC") == 0) {
     inst->driver = &RCL_PHC_driver;
-    inst->precision = 1e-9;
   } else {
     LOG_FATAL("unknown refclock driver %s", params->driver_name);
     return 0;
@@ -207,8 +203,8 @@ RCL_AddRefclock(RefclockParameters *params)
   inst->lock_ref = params->lock_ref_id;
   inst->offset = params->offset;
   inst->delay = params->delay;
-  if (params->precision > 0.0)
-    inst->precision = params->precision;
+  inst->precision = LCL_GetSysPrecisionAsQuantum();
+  inst->precision = MAX(inst->precision, params->precision);
   inst->pulse_width = params->pulse_width;
   inst->timeout_id = -1;
   inst->source = NULL;