]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
refclock_phc: add nocrossts option
authorMiroslav Lichvar <mlichvar@redhat.com>
Thu, 19 Jan 2017 15:28:49 +0000 (16:28 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 23 Jan 2017 14:58:55 +0000 (15:58 +0100)
doc/chrony.conf.adoc
refclock_phc.c

index 3dc4189ec1d906b768078efdd2184d399d342366..e4b0616c5d67818e6ae403958daa9ccbecd4ad13 100644 (file)
@@ -402,9 +402,10 @@ refclock SOCK /var/run/chrony.ttyS0.sock
 *PHC*:::
 PTP hardware clock (PHC) driver. The parameter is the path to the device of
 the PTP clock, which for example can be synchronised by *ptp4l* from
-http://linuxptp.sourceforge.net[*linuxptp*]. PTP clocks are typically kept in
-TAI instead of UTC, so the *offset* option should be used to compensate for the
-current UTC-TAI offset. For example:
+http://linuxptp.sourceforge.net[*linuxptp*]. String *:nocrossts* can be
+appended to the path to disable use of precise cross timestamping. PTP clocks
+are typically kept in TAI instead of UTC, so the *offset* option should be used
+to compensate for the current UTC-TAI offset. For example:
 +
 ----
 refclock PHC /dev/ptp0 poll 3 dpoll -2 offset -36
index 2bbed3dd5b15c9d1222a671d1e10b10a2528d954..e505b32d323791b70676f1f480c76ea7ccc93013 100644 (file)
@@ -42,6 +42,7 @@
 struct phc_instance {
   int fd;
   int mode;
+  int nocrossts;
 };
 
 static int phc_initialise(RCL_Instance instance)
@@ -61,6 +62,7 @@ static int phc_initialise(RCL_Instance instance)
   phc = MallocNew(struct phc_instance);
   phc->fd = phc_fd;
   phc->mode = 0;
+  phc->nocrossts = RCL_GetDriverOption(instance, "nocrossts") ? 1 : 0;
 
   RCL_SetDriverData(instance, phc);
   return 1;
@@ -83,8 +85,8 @@ static int phc_poll(RCL_Instance instance)
 
   phc = (struct phc_instance *)RCL_GetDriverData(instance);
 
-  if (!SYS_Linux_GetPHCSample(phc->fd, 0, RCL_GetPrecision(instance), &phc->mode,
-                              &phc_ts, &sys_ts, &err))
+  if (!SYS_Linux_GetPHCSample(phc->fd, phc->nocrossts, RCL_GetPrecision(instance),
+                              &phc->mode, &phc_ts, &sys_ts, &err))
     return 0;
 
   offset = UTI_DiffTimespecsToDouble(&phc_ts, &sys_ts);