From 33aa7a3c579935a0c61af07bb2b7324af80e18f0 Mon Sep 17 00:00:00 2001 From: Andreas Karlsson Date: Fri, 14 Aug 2020 15:35:45 +0200 Subject: [PATCH] Correct unit for dc mastertime calulcation to (ns) The correct factor for seconds should be 1000000000 fixes #432 --- soem/ethercatdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soem/ethercatdc.c b/soem/ethercatdc.c index b6220b1..a64b1ae 100644 --- a/soem/ethercatdc.c +++ b/soem/ethercatdc.c @@ -270,7 +270,7 @@ boolean ecx_configdc(ecx_contextt *context) ecx_BWR(context->port, 0, ECT_REG_DCTIME0, sizeof(ht), &ht, EC_TIMEOUTRET); /* latch DCrecvTimeA of all slaves */ mastertime = osal_current_time(); mastertime.sec -= 946684800UL; /* EtherCAT uses 2000-01-01 as epoch start instead of 1970-01-01 */ - mastertime64 = (((uint64)mastertime.sec * 1000000) + (uint64)mastertime.usec) * 1000; + mastertime64 = (((uint64)mastertime.sec * 1000000000) + (uint64)mastertime.usec) * 1000; for (i = 1; i <= *(context->slavecount); i++) { context->slavelist[i].consumedports = context->slavelist[i].activeports;