Skip to content

Commit bb214a8

Browse files
Merge pull request #173 from Sandyman/master
Allow for timestamps of other types than float
2 parents cdd7d51 + df898c6 commit bb214a8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

canopen/pdo/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def __init__(self, pdo_node, com_record, map_array):
174174
#: Current message data
175175
self.data = bytearray()
176176
#: Timestamp of last received message
177-
self.timestamp = 0
177+
self.timestamp = None
178178
#: Period of receive message transmission in seconds
179179
self.period = None
180180
self.callbacks = []
@@ -268,7 +268,8 @@ def on_message(self, can_id, data, timestamp):
268268
with self.receive_condition:
269269
self.is_received = True
270270
self.data = data
271-
self.period = timestamp - self.timestamp
271+
if self.timestamp is not None:
272+
self.period = timestamp - self.timestamp
272273
self.timestamp = timestamp
273274
self.receive_condition.notify_all()
274275
for callback in self.callbacks:

0 commit comments

Comments
 (0)