diff --git a/conf.c b/conf.c index e2376b3..3df90df 100644 --- 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 6bfdf7f..c2acc3a 100644 --- 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; diff --git a/doc/chrony.conf.adoc b/doc/chrony.conf.adoc index ddae174..8e6fa96 100644 --- a/doc/chrony.conf.adoc +++ b/doc/chrony.conf.adoc @@ -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 diff --git a/ntp_io_linux.c b/ntp_io_linux.c index 8470d4d..41a8903 100644 --- a/ntp_io_linux.c +++ b/ntp_io_linux.c @@ -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;