From 8a27a225cff99f54f0781e45818c923b8d0ffe9f Mon Sep 17 00:00:00 2001 From: Jan Rinze Peterzon <peterzon@astron.nl> Date: Thu, 10 Mar 2016 08:02:43 +0000 Subject: [PATCH] Task #9116: improved parsing of modificationTime --- SAS/OTDB_Services/OTDBBusListener.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/SAS/OTDB_Services/OTDBBusListener.py b/SAS/OTDB_Services/OTDBBusListener.py index 102f8fcf07a..75854d5bf9d 100644 --- a/SAS/OTDB_Services/OTDBBusListener.py +++ b/SAS/OTDB_Services/OTDBBusListener.py @@ -58,7 +58,13 @@ class OTDBBusListener(AbstractBusListener): treeId = msg.content['treeID'] modificationTime = datetime.utcnow() if 'time_of_change' in msg.content: - modificationTime = msg.content['time_of_change'].datetime() + try: + if msg.content['time_of_change'][-7] == '.': + modificationTime = datetime.strptime(msg.content['time_of_change'], '%Y-%m-%dT%H:%M:%S.%f') + else: + modificationTime = datetime.strptime(msg.content['time_of_change'], '%Y-%m-%dT%H:%M:%S') + except: + pass if msg.content['state'] == 'described': self.onObservationDescribed(treeId, modificationTime) -- GitLab