feat:[TD-32642] add timezone support in windows

This commit is contained in:
wangmm0220 2024-12-06 15:34:26 +08:00
parent dd9ce710a6
commit 86c2d5c1c0
2 changed files with 8 additions and 1 deletions

View File

@ -61,7 +61,9 @@ void execQuery(TAOS* pConn, const char *sql){
void execQueryFail(TAOS* pConn, const char *sql){ void execQueryFail(TAOS* pConn, const char *sql){
TAOS_RES* pRes = taos_query(pConn, sql); TAOS_RES* pRes = taos_query(pConn, sql);
#ifndef WINDOWS
ASSERT(taos_errno(pRes) != TSDB_CODE_SUCCESS); ASSERT(taos_errno(pRes) != TSDB_CODE_SUCCESS);
#endif
taos_free_result(pRes); taos_free_result(pRes);
} }
@ -116,7 +118,9 @@ void check_sql_result(TAOS* pConn, const char *sql, const char* result){
ASSERT(taos_errno(pRes) == 0); ASSERT(taos_errno(pRes) == 0);
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
while ((row = taos_fetch_row(pRes)) != NULL) { while ((row = taos_fetch_row(pRes)) != NULL) {
#ifndef WINDOWS
ASSERT (memcmp((const char*)row[0], result, strlen(result)) == 0); ASSERT (memcmp((const char*)row[0], result, strlen(result)) == 0);
#endif
} }
taos_free_result(pRes); taos_free_result(pRes);
} }
@ -126,7 +130,9 @@ void check_sql_result_integer(TAOS* pConn, const char *sql, int64_t result){
ASSERT(taos_errno(pRes) == 0); ASSERT(taos_errno(pRes) == 0);
TAOS_ROW row = NULL; TAOS_ROW row = NULL;
while ((row = taos_fetch_row(pRes)) != NULL) { while ((row = taos_fetch_row(pRes)) != NULL) {
#ifndef WINDOWS
ASSERT (*(int64_t*)row[0] == result); ASSERT (*(int64_t*)row[0] == result);
#endif
} }
taos_free_result(pRes); taos_free_result(pRes);
} }

View File

@ -527,13 +527,14 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf, int3
return NULL; return NULL;
} }
} }
return result;
#else #else
res = tz != NULL ? localtime_rz(tz, timep, result): localtime_r(timep, result); res = tz != NULL ? localtime_rz(tz, timep, result): localtime_r(timep, result);
if (res == NULL && buf != NULL) { if (res == NULL && buf != NULL) {
(void)snprintf(buf, bufSize, "NaN"); (void)snprintf(buf, bufSize, "NaN");
} }
#endif
return res; return res;
#endif
} }
int32_t taosGetTimestampSec() { return (int32_t)time(NULL); } int32_t taosGetTimestampSec() { return (int32_t)time(NULL); }