Skip to content

Commit

Permalink
OPCUA converter timestamp = int(time() * 1000)
Browse files Browse the repository at this point in the history
  • Loading branch information
smatvienko-tb committed Sep 10, 2024
1 parent a788bb7 commit 66c4464
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions thingsboard_gateway/connectors/opcua/opcua_uplink_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def convert(self, configs, values):
telemetry_datapoints_count = 0
attributes_datapoints_count = 0

basic_timestamp = int(time() * 1000)
timestamp = int(time() * 1000)

for val, config in zip(values, configs):
if not val:
Expand All @@ -91,16 +91,6 @@ def convert(self, configs, values):

section = DATA_TYPES[config['section']]

if val.SourceTimestamp is not None:
if abs(basic_timestamp - val.SourceTimestamp.timestamp()) > 3600:
self._log.warning("Timestamps are not in sync for incoming value: %r. "
"Value timestamp: %s, current timestamp: %s",
val, val.SourceTimestamp.timestamp(), basic_timestamp)
else:
basic_timestamp = val.SourceTimestamp.timestamp() * 1000

timestamp = basic_timestamp

if val.SourceTimestamp and section == TELEMETRY_PARAMETER:
telemetry_datapoints_count += 1
if timestamp in telemetry_datapoints:
Expand Down

0 comments on commit 66c4464

Please sign in to comment.