From ed82e35666be48972754e78a1073e740602648b3 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Tue, 14 Apr 2015 14:51:18 +0200 Subject: [PATCH] json: always use UTC datetime format (#6927) --- wcs/qommon/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wcs/qommon/misc.py b/wcs/qommon/misc.py index 30cd272..198848e 100644 --- a/wcs/qommon/misc.py +++ b/wcs/qommon/misc.py @@ -388,6 +388,6 @@ def indent_xml(elem, level=0): class JSONEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, time.struct_time): - return qommon.strftime.strftime('%Y-%m-%dT%H:%M:%S', obj) + return datetime.datetime.utcfromtimestamp(time.mktime(obj)).isoformat() + 'Z' # Let the base class default method raise the TypeError return json.JSONEncoder.default(self, obj) -- 2.1.4