Skip to content

Commit

Permalink
Correct unit for dc mastertime calulcation to (ns)
Browse files Browse the repository at this point in the history
The correct factor for seconds should be 1000000000

fixes OpenEtherCATsociety#432
  • Loading branch information
Andreas Karlsson committed Aug 16, 2020
1 parent bae37b9 commit 33aa7a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion soem/ethercatdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 33aa7a3

Please sign in to comment.