Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
osie
Commits
c9d9827d
Commit
c9d9827d
authored
Apr 26, 2022
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print micro seconds since epoch.
parent
49a9ad06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
coupler/opc-ua-server/common.h
coupler/opc-ua-server/common.h
+11
-0
coupler/opc-ua-server/keep_alive_subscriber.h
coupler/opc-ua-server/keep_alive_subscriber.h
+3
-1
No files found.
coupler/opc-ua-server/common.h
View file @
c9d9827d
...
...
@@ -2,8 +2,19 @@
* See http://creativecommons.org/publicdomain/zero/1.0/for more information. */
#define countof(a) (sizeof(a)/sizeof(*(a)))
#include <sys/time.h>
#include <stdio.h>
#include <open62541/server.h>
int
getMicroSeconds
()
{
struct
timeval
current_time
;
gettimeofday
(
&
current_time
,
NULL
);
long
int
ms
=
current_time
.
tv_sec
*
1000
+
current_time
.
tv_usec
/
1000
;
return
ms
;
}
/* loadFile parses the certificate file.
*
* @param path specifies the file name given in argv[]
...
...
coupler/opc-ua-server/keep_alive_subscriber.h
View file @
c9d9827d
...
...
@@ -28,12 +28,14 @@ static void dataChangeNotificationCallback(UA_Server *server, UA_UInt32 monitore
void
*
monitoredItemContext
,
const
UA_NodeId
*
nodeId
,
void
*
nodeContext
,
UA_UInt32
attributeId
,
const
UA_DataValue
*
var
)
{
long
int
micro_seconds
=
getMicroSeconds
();
// filter out ID from Data Set
if
(
UA_Variant_hasScalarType
(
&
var
->
value
,
&
UA_TYPES
[
UA_TYPES_UINT32
]))
{
unsigned
int
coupler_id
=
*
(
UA_UInt32
*
)
var
->
value
.
data
;
if
(
coupler_id
!=
COUPLER_ID
)
{
// care for other coupler_id NOT ourselves
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"ID = %d
"
,
coupler_id
);
UA_LOG_INFO
(
UA_Log_Stdout
,
UA_LOGCATEGORY_USERLAND
,
"ID = %d
, microseconds=%ld"
,
coupler_id
,
micro_seconds
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment