From 6617d22b7d70c7ab0877cb4881f9ef29b07268e6 Mon Sep 17 00:00:00 2001 From: maikebing Date: Sat, 20 Jul 2019 09:53:35 +0800 Subject: [PATCH] Modify json's date to Json standard time format ISO-8601 --- src/modules/http/src/httpJson.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/http/src/httpJson.c b/src/modules/http/src/httpJson.c index cb036d71c9..7e503f89c3 100644 --- a/src/modules/http/src/httpJson.c +++ b/src/modules/http/src/httpJson.c @@ -240,11 +240,11 @@ void httpJsonTimestamp(JsonBuf* buf, int64_t t) { struct tm* ptm; time_t tt = t / 1000; ptm = localtime(&tt); - int length = (int)strftime(ts, 30, "%Y-%m-%d %H:%M:%S", ptm); + int length = (int)strftime(ts, 30, "%Y-%m-%dT%H:%M:%S", ptm); - snprintf(ts+length, MAX_NUM_STR_SZ, ".%03ld", t % 1000); + snprintf(ts+length, MAX_NUM_STR_SZ, ".%03ldZ", t % 1000); - httpJsonString(buf, ts, length + 4); + httpJsonString(buf, ts, length + 5); } void httpJsonInt(JsonBuf* buf, int num) { @@ -396,4 +396,4 @@ void httpJsonPairStatus(JsonBuf* buf, int code) { httpJsonPair(buf, "desc", 4, tsError[code], (int)strlen(tsError[code])); } } -} \ No newline at end of file +} -- GitLab