From 5ee80ac3bbb2afbf94209f0e7216f14781c67145 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Fri, 29 Nov 2024 10:25:59 +0800 Subject: [PATCH] feat:[TD-32642] add timezone for connection support --- source/client/test/timezoneTest.cpp | 26 +++++++++++++++++++------- source/common/src/ttime.c | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/source/client/test/timezoneTest.cpp b/source/client/test/timezoneTest.cpp index a9b31231bc..2ea2860d15 100644 --- a/source/client/test/timezoneTest.cpp +++ b/source/client/test/timezoneTest.cpp @@ -185,16 +185,28 @@ TEST(timezoneCase, alter_timezone_Test) { char *tz_test[] = { "2023-09-16 17:00:00+", - "2023-09-16 17:00:00+8:", - "2023-09-16 17:00:00+:30", - "2023-09-16 17:00:00+:-30", - "2023-09-16 17:00:00++:-30", + "2023-09-16 17:00:00+a", + "2023-09-16 17:00:00+8", + "2023-09-16 17:00:00+832", + "2023-09-16 17:00:00+8323", "2023-09-16 17:00:00+:", + "2023-09-16 17:00:00+8:", + "2023-09-16 17:00:00++:", + "2023-09-16 17:00:00+d:", + "2023-09-16 17:00:00+09:", "2023-09-16 17:00:00+8f:", "2023-09-16 17:00:00+080:", - "2023-09-16 17:00:00+a", - "2023-09-16 17:00:00+09:", - "2023-09-16 17:00:00+09:a", + "2023-09-16 17:00:00+:30", + "2023-09-16 17:00:00+:3", + "2023-09-16 17:00:00+:093", + "2023-09-16 17:00:00+:-30", + "2023-09-16 17:00:00++:-30", + "2023-09-16 17:00:00+8:8", + "2023-09-16 17:00:00+8:2a", + "2023-09-16 17:00:00+8:08", + "2023-09-16 17:00:00+8:038", + "2023-09-16 17:00:00+08:8", + "2023-09-16 17:00:00+09:3a", "2023-09-16 17:00:00+09:abc", "2023-09-16 17:00:00+09:001", }; diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 47747611d9..45b5ab6564 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -131,7 +131,7 @@ int32_t parseFraction(char* str, char** end, int32_t timePrec, int64_t* pFractio } #define PARSE(str,len,result) \ - if (len > 2 || len < 1) {\ + if (len != 2) {\ TAOS_RETURN(TSDB_CODE_INVALID_PARA);\ }\ result = strnatoi(str, len);