diff --git a/SAS/OTDB_Services/OTDBBusListener.py b/SAS/OTDB_Services/OTDBBusListener.py index 102f8fcf07a9f93ee970110a6459700f100e4b95..75854d5bf9d25a64a60b3485aee0cc6e63f03e86 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)