Skip to content

Commit

Permalink
feat(pubsub): Use EventLoop time source in ua_pubsub_writer.c
Browse files Browse the repository at this point in the history
  • Loading branch information
jpfr committed Oct 11, 2023
1 parent 12f4466 commit 43fa5ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pubsub/ua_pubsub_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server,
UA_DataSetWriter *dataSetWriter) {
UA_Boolean heartbeat = false;
UA_PublishedDataSet *currentDataSet = NULL;

if(UA_NodeId_isNull(&dataSetWriter->connectedDataSet)){
heartbeat = true;
} else {
Expand All @@ -714,6 +714,9 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server,
}
}

UA_WriterGroup *wg = UA_WriterGroup_findWGbyId(server, dataSetWriter->linkedWriterGroup);
UA_EventLoop *el = UA_PubSubConnection_getEL(server, wg->linkedConnection);

/* Reset the message */
memset(dataSetMessage, 0, sizeof(UA_DataSetMessage));

Expand Down Expand Up @@ -804,7 +807,7 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server,
if((u64)dsm->dataSetMessageContentMask &
(u64)UA_UADPDATASETMESSAGECONTENTMASK_TIMESTAMP) {
dataSetMessage->header.timestampEnabled = true;
dataSetMessage->header.timestamp = UA_DateTime_now();
dataSetMessage->header.timestamp = el->dateTime_now(el);
}

/* TODO: Picoseconds resolution not supported atm */
Expand Down Expand Up @@ -850,7 +853,7 @@ UA_DataSetWriter_generateDataSetMessage(UA_Server *server,
if((u64)jsonDsm->dataSetMessageContentMask &
(u64)UA_JSONDATASETMESSAGECONTENTMASK_TIMESTAMP) {
dataSetMessage->header.timestampEnabled = true;
dataSetMessage->header.timestamp = UA_DateTime_now();
dataSetMessage->header.timestamp = el->dateTime_now(el);
}

/* TODO: Statuscode not supported yet */
Expand Down

0 comments on commit 43fa5ee

Please sign in to comment.