Skip to content

Commit

Permalink
DC: change to EtherCAT epoch
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Heden committed Feb 17, 2016
1 parent 82edc9a commit 918a6ba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion soem/ethercatdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ boolean ecx_configdc(ecx_contextt *context)
context->slavelist[0].hasdc = FALSE;
context->grouplist[0].hasdc = FALSE;
ht = 0;
mastertime = osal_current_time();

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;
for (i = 1; i <= *(context->slavecount); i++)
{
Expand Down

0 comments on commit 918a6ba

Please sign in to comment.