]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
conf: add precision option to hwtimestamp directive
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 19 Jan 2017 11:40:18 +0000 (12:40 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 23 Jan 2017 14:58:55 +0000 (15:58 +0100)
conf.c
conf.h
doc/chrony.conf.adoc
ntp_io_linux.c

diff --git a/conf.c b/conf.c
index e2376b3af9221c01e24ab635efeee5d9f10fcd50..3df90dff7f7424cc628ed18a1194d8dc26b864fc 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -1259,13 +1259,17 @@ parse_hwtimestamp(char *line)
 
   iface = ARR_GetNewElement(hwts_interfaces);
   iface->name = Strdup(p);
+  iface->precision = 100.0e-9;
   iface->tx_comp = 0.0;
   iface->rx_comp = 0.0;
 
   for (p = line; *p; line += n, p = line) {
     line = CPS_SplitWord(line);
 
-    if (!strcasecmp(p, "rxcomp")) {
+    if (!strcasecmp(p, "precision")) {
+      if (sscanf(line, "%lf%n", &iface->precision, &n) != 1)
+        break;
+    } else if (!strcasecmp(p, "rxcomp")) {
       if (sscanf(line, "%lf%n", &iface->rx_comp, &n) != 1)
         break;
     } else if (!strcasecmp(p, "txcomp")) {
diff --git a/conf.h b/conf.h
index 6bfdf7fc67a4b27a2f08bb0641ed41395bc7093c..c2acc3a523e3e5747ddb6c95af5ce10e673faa62 100644 (file)
--- a/conf.h
+++ b/conf.h
@@ -121,6 +121,7 @@ extern double CNF_GetInitStepThreshold(void);
 
 typedef struct {
   char *name;
+  double precision;
   double tx_comp;
   double rx_comp;
 } CNF_HwTsInterface;
index ddae1740ea4c41fe7551e853818a725376964110..8e6fa96552076c0edb45ad69ebe071f29d3007db 100644 (file)
@@ -1818,6 +1818,9 @@ on all available interfaces.
 +
 The *hwtimestamp* directive has the following options:
 +
+*precision* _precision_:::
+This option specifies the assumed precision of reading of the NIC clock. The
+default value is 100e-9 (100 nanoseconds).
 *txcomp* _compensation_:::
 This option specifies the difference in seconds between the actual transmission
 time at the physical layer and the reported transmit timestamp. This value will
index 8470d4d1348351e6c387dd83d269a237090a6a5e..41a8903625268b597e27018db7be854894a746f5 100644 (file)
@@ -175,7 +175,7 @@ add_interface(CNF_HwTsInterface *conf_iface)
   iface->l2_udp4_ntp_start = 42;
   iface->l2_udp6_ntp_start = 62;
 
-  iface->precision = 100.0e-9;
+  iface->precision = conf_iface->precision;
   iface->tx_comp = conf_iface->tx_comp;
   iface->rx_comp = conf_iface->rx_comp;