summaryrefslogtreecommitdiff
path: root/daemons/gptp/linux/src/daemon_cl.cpp
diff options
context:
space:
mode:
authorChristopher S. Hall <christopher.s.hall@intel.com>2018-06-04 13:43:52 -0400
committerChristopher S. Hall <christopher.s.hall@intel.com>2018-06-12 10:54:27 -0400
commit87acb2c7a6423db8df70acdcd2404785b3198a74 (patch)
treedafacce2d09cc3369d2b62f0dc9475b1ee7cdfd7 /daemons/gptp/linux/src/daemon_cl.cpp
parent247413605cc4cda855ea89cc6b5c4168a247a91a (diff)
downloadOpen-AVB-87acb2c7a6423db8df70acdcd2404785b3198a74.tar.gz
gptp: Add monotonic raw clock option
Timestamp clocks that implement the PTP_SYS_OFFSET_PRECISE ioctl return cross-timestamps with respect to monotonic raw and realtime Add configuration file option allowing clock selection for system/local clock relation The default clock type is Realtime which is equivalent to the CLOCK_REALTIME option to clock_gettime Optionally, MonotonicRaw (equivalent to CLOCK_MONOTONIC_RAW) can be specified in the gPTP daemon configuration file: [clock] SystemClock = MonotonicRaw Fixed Makefile issue where some shell configurations use built-in 'echo' and others don't Forces all to use /bin/echo
Diffstat (limited to 'daemons/gptp/linux/src/daemon_cl.cpp')
-rw-r--r--daemons/gptp/linux/src/daemon_cl.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/daemons/gptp/linux/src/daemon_cl.cpp b/daemons/gptp/linux/src/daemon_cl.cpp
index 3a6d95e5..53a8f9a4 100644
--- a/daemons/gptp/linux/src/daemon_cl.cpp
+++ b/daemons/gptp/linux/src/daemon_cl.cpp
@@ -150,6 +150,7 @@ int main(int argc, char **argv)
LinuxIPCArg *ipc_arg = NULL;
bool use_config_file = false;
char config_file_path[512];
+ const char *systemClockDesc = NULL;
memset(config_file_path, 0, 512);
GPTPPersist *pGPTPPersist = NULL;
@@ -424,6 +425,11 @@ int main(int argc, char **argv)
portInit.syncReceiptThreshold =
iniParser.getSyncReceiptThresh();
+ if( strnlen( iniParser.getSystemClockDesc(),
+ MAX_CLOCK_DESC_LEN ) != 0 )
+ systemClockDesc =
+ iniParser.getSystemClockDesc();
+
/*Only overwrites phy_delay default values if not input_delay switch enabled*/
if(!input_delay)
{
@@ -433,6 +439,14 @@ int main(int argc, char **argv)
}
+ if( systemClockDesc != NULL )
+ {
+ if( timestamper->HWTimestamper_setsystemclock
+ ( systemClockDesc ))
+ GPTP_LOG_INFO
+ ( "Using system Clock: %s", systemClockDesc );
+ }
+
pPort = new EtherPort(&portInit);
if (!pPort->init_port()) {