refclock_phc: add nocrossts option
This commit is contained in:
parent
50f99ec5f4
commit
a60fc73e7b
2 changed files with 8 additions and 5 deletions
|
@ -402,9 +402,10 @@ refclock SOCK /var/run/chrony.ttyS0.sock
|
||||||
*PHC*:::
|
*PHC*:::
|
||||||
PTP hardware clock (PHC) driver. The parameter is the path to the device of
|
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
|
the PTP clock, which for example can be synchronised by *ptp4l* from
|
||||||
http://linuxptp.sourceforge.net[*linuxptp*]. PTP clocks are typically kept in
|
http://linuxptp.sourceforge.net[*linuxptp*]. String *:nocrossts* can be
|
||||||
TAI instead of UTC, so the *offset* option should be used to compensate for the
|
appended to the path to disable use of precise cross timestamping. PTP clocks
|
||||||
current UTC-TAI offset. For example:
|
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
|
refclock PHC /dev/ptp0 poll 3 dpoll -2 offset -36
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
struct phc_instance {
|
struct phc_instance {
|
||||||
int fd;
|
int fd;
|
||||||
int mode;
|
int mode;
|
||||||
|
int nocrossts;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int phc_initialise(RCL_Instance instance)
|
static int phc_initialise(RCL_Instance instance)
|
||||||
|
@ -61,6 +62,7 @@ static int phc_initialise(RCL_Instance instance)
|
||||||
phc = MallocNew(struct phc_instance);
|
phc = MallocNew(struct phc_instance);
|
||||||
phc->fd = phc_fd;
|
phc->fd = phc_fd;
|
||||||
phc->mode = 0;
|
phc->mode = 0;
|
||||||
|
phc->nocrossts = RCL_GetDriverOption(instance, "nocrossts") ? 1 : 0;
|
||||||
|
|
||||||
RCL_SetDriverData(instance, phc);
|
RCL_SetDriverData(instance, phc);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -83,8 +85,8 @@ static int phc_poll(RCL_Instance instance)
|
||||||
|
|
||||||
phc = (struct phc_instance *)RCL_GetDriverData(instance);
|
phc = (struct phc_instance *)RCL_GetDriverData(instance);
|
||||||
|
|
||||||
if (!SYS_Linux_GetPHCSample(phc->fd, 0, RCL_GetPrecision(instance), &phc->mode,
|
if (!SYS_Linux_GetPHCSample(phc->fd, phc->nocrossts, RCL_GetPrecision(instance),
|
||||||
&phc_ts, &sys_ts, &err))
|
&phc->mode, &phc_ts, &sys_ts, &err))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
offset = UTI_DiffTimespecsToDouble(&phc_ts, &sys_ts);
|
offset = UTI_DiffTimespecsToDouble(&phc_ts, &sys_ts);
|
||||||
|
|
Loading…
Reference in a new issue