mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Added timestamp to OPAL-UDP client messages
This commit is contained in:
parent
8fe60f38cc
commit
790c85c066
1 changed files with 6 additions and 2 deletions
|
@ -128,13 +128,17 @@ static void *SendToIPPort(void *arg)
|
|||
/* Read data from the model */
|
||||
OpalGetAsyncSendIconData(mdldata, mdldata_size, SendID);
|
||||
|
||||
/* Get current time */
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_REALTIME, &now);
|
||||
|
||||
msg.length = mdldata_size / sizeof(double);
|
||||
for (i = 0; i < msg.length; i++)
|
||||
msg.data[i].f = (float) mdldata[i];
|
||||
|
||||
/* Convert to network byte order */
|
||||
msg.sequence = seq++;
|
||||
msg.length = msg.length;
|
||||
msg.ts.sec = now.tv_sec;
|
||||
msg.ts.nsec = now.tc_nsec;
|
||||
|
||||
/* Perform the actual write to the ip port */
|
||||
if (SendPacket((char *) &msg, MSG_LEN(&msg)) < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue