From c44553198998726104a4d1b3d413ad98eabffccf Mon Sep 17 00:00:00 2001 From: aor-fokus Date: Tue, 5 Feb 2019 16:23:04 +0100 Subject: [PATCH] fixing type of timestamp --- apps/OrionContextBroker/src/orioncontextbroker/orion_api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/OrionContextBroker/src/orioncontextbroker/orion_api.py b/apps/OrionContextBroker/src/orioncontextbroker/orion_api.py index c921630..6bd518e 100644 --- a/apps/OrionContextBroker/src/orioncontextbroker/orion_api.py +++ b/apps/OrionContextBroker/src/orioncontextbroker/orion_api.py @@ -1,5 +1,6 @@ from urllib.parse import urljoin import logging +from datetime import datetime import requests @@ -89,7 +90,8 @@ class OrionAPI(LoggerMixin): "type": self._get_type(data_senml["v"]), "metadata": { "timestamp": { - "value": data_senml["t"], + "value": datetime.fromtimestamp(float(data_senml["t"])).replace(microsecond=0).isoformat() + if data_senml["t"] != "none" else data_senml["t"], "type": "String" }, "bn": {