Fix timezone case failed.

This commit is contained in:
xiao-77 2025-02-08 10:42:15 +08:00
parent e7c67a9371
commit d8c19b8804
3 changed files with 15 additions and 0 deletions

View File

@ -35,6 +35,7 @@ time_t mktime_z(timezone_t, struct tm *);
timezone_t tzalloc(char const *);
void tzfree(timezone_t);
void getTimezoneStr(char *tz);
void truncateTimezoneString(char *tz);
#endif

View File

@ -872,6 +872,13 @@ END:
}
#endif
void truncateTimezoneString(char *tz) {
char *spacePos = strchr(tz, ' ');
if (spacePos != NULL) {
*spacePos = '\0';
}
}
int32_t taosGetSystemTimezone(char *outTimezoneStr) {
#ifdef WINDOWS
char value[100] = {0};

View File

@ -134,7 +134,14 @@ int32_t cfgUpdateFromArray(SConfig *pCfg, SArray *pArgs) {
break;
case CFG_DTYPE_LOCALE:
case CFG_DTYPE_CHARSET:
code = cfgSetItemVal(pItemOld, pItemNew->name, pItemNew->str, pItemNew->stype);
if (code != TSDB_CODE_SUCCESS) {
(void)taosThreadMutexUnlock(&pCfg->lock);
TAOS_RETURN(code);
}
break;
case CFG_DTYPE_TIMEZONE:
truncateTimezoneString(pItemNew->str);
code = cfgSetItemVal(pItemOld, pItemNew->name, pItemNew->str, pItemNew->stype);
if (code != TSDB_CODE_SUCCESS) {
(void)taosThreadMutexUnlock(&pCfg->lock);