Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
c712e581
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c712e581
编写于
3月 26, 2022
作者:
wafwerar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-13772]<fix>: add timezone enum.
上级
ed308f45
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
121 addition
and
69 deletion
+121
-69
include/os/os.h
include/os/os.h
+2
-2
include/os/osEnv.h
include/os/osEnv.h
+14
-12
include/os/osTimezone.h
include/os/osTimezone.h
+31
-2
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-2
source/common/src/tglobal.c
source/common/src/tglobal.c
+5
-4
source/dnode/mgmt/dnode/src/dmMsg.c
source/dnode/mgmt/dnode/src/dmMsg.c
+1
-1
source/dnode/mnode/impl/src/mndDnode.c
source/dnode/mnode/impl/src/mndDnode.c
+3
-3
source/dnode/vnode/src/vnd/vnodeWrite.c
source/dnode/vnode/src/vnd/vnodeWrite.c
+1
-1
source/os/src/osEnv.c
source/os/src/osEnv.c
+29
-23
source/os/src/osMemory.c
source/os/src/osMemory.c
+3
-5
source/os/src/osTimezone.c
source/os/src/osTimezone.c
+30
-14
未找到文件。
include/os/os.h
浏览文件 @
c712e581
...
...
@@ -75,7 +75,6 @@ extern "C" {
#include "osDef.h"
#include "osDir.h"
#include "osEndian.h"
#include "osEnv.h"
#include "osFile.h"
#include "osLocale.h"
#include "osLz4.h"
...
...
@@ -93,8 +92,9 @@ extern "C" {
#include "osTime.h"
#include "osTimer.h"
#include "osTimezone.h"
#include "osEnv.h"
void
osInit
();
void
os
Default
Init
();
#ifdef __cplusplus
}
...
...
include/os/osEnv.h
浏览文件 @
c712e581
...
...
@@ -22,17 +22,18 @@
extern
"C"
{
#endif
extern
char
tsOsName
[];
extern
char
tsTimezone
[];
extern
char
tsCharset
[];
extern
char
tsLocale
[];
extern
int8_t
tsDaylight
;
extern
bool
tsEnableCoreFile
;
extern
int64_t
tsPageSizeKB
;
extern
int64_t
tsOpenMax
;
extern
int64_t
tsStreamMax
;
extern
float
tsNumOfCores
;
extern
int64_t
tsTotalMemoryKB
;
extern
char
tsOsName
[];
extern
char
tsTimezoneStr
[];
extern
enum
TdTimezone
tsTimezone
;
extern
char
tsCharset
[];
extern
char
tsLocale
[];
extern
int8_t
tsDaylight
;
extern
bool
tsEnableCoreFile
;
extern
int64_t
tsPageSizeKB
;
extern
int64_t
tsOpenMax
;
extern
int64_t
tsStreamMax
;
extern
float
tsNumOfCores
;
extern
int64_t
tsTotalMemoryKB
;
extern
char
configDir
[];
extern
char
tsDataDir
[];
...
...
@@ -43,11 +44,12 @@ extern SDiskSpace tsDataSpace;
extern
SDiskSpace
tsLogSpace
;
extern
SDiskSpace
tsTempSpace
;
void
osInit
();
void
os
Default
Init
();
void
osUpdate
();
void
osCleanup
();
bool
osLogSpaceAvailable
();
void
osSetTimezone
(
const
char
*
timezone
);
void
osSetSystemLocale
(
const
char
*
inLocale
,
const
char
*
inCharSet
);
#ifdef __cplusplus
}
...
...
include/os/osTimezone.h
浏览文件 @
c712e581
...
...
@@ -26,8 +26,37 @@ extern "C" {
#define tzset TZSET_FUNC_TAOS_FORBID
#endif
void
taosGetSystemTimezone
(
char
*
outTimezone
);
void
taosSetSystemTimezone
(
const
char
*
inTimezone
,
char
*
outTimezone
,
int8_t
*
outDaylight
);
enum
TdTimezone
{
TdWestZone12
=-
12
,
TdWestZone11
,
TdWestZone10
,
TdWestZone9
,
TdWestZone8
,
TdWestZone7
,
TdWestZone6
,
TdWestZone5
,
TdWestZone4
,
TdWestZone3
,
TdWestZone2
,
TdWestZone1
,
TdZeroZero
,
TdEastZone1
,
TdEastZone2
,
TdEastZone3
,
TdEastZone4
,
TdEastZone5
,
TdEastZone6
,
TdEastZone7
,
TdEastZone8
,
TdEastZone9
,
TdEastZone10
,
TdEastZone11
,
TdEastZone12
};
void
taosGetSystemTimezone
(
char
*
outTimezone
,
enum
TdTimezone
*
tsTimezone
);
void
taosSetSystemTimezone
(
const
char
*
inTimezone
,
char
*
outTimezone
,
int8_t
*
outDaylight
,
enum
TdTimezone
*
tsTimezone
);
#ifdef __cplusplus
}
...
...
source/client/src/clientEnv.c
浏览文件 @
c712e581
...
...
@@ -408,10 +408,10 @@ int taos_options_imp(TSDB_OPTION option, const char *str) {
assert(cfg != NULL);
if (cfg->cfgStatus <= TAOS_CFG_CSTATUS_OPTION) {
tstrncpy(tsTimezone, str, TD_TIMEZONE_LEN);
tstrncpy(tsTimezone
Str
, str, TD_TIMEZONE_LEN);
tsSetTimeZone();
cfg->cfgStatus = TAOS_CFG_CSTATUS_OPTION;
tscDebug("timezone set:%s, input:%s by taos_options", tsTimezone, str);
tscDebug("timezone set:%s, input:%s by taos_options", tsTimezone
Str
, str);
} else {
tscWarn("config option:%s, input value:%s, is configured by %s, use %s", cfg->option, str,
tsCfgStatusStr[cfg->cfgStatus], (char *)cfg->ptr);
...
...
source/common/src/tglobal.c
浏览文件 @
c712e581
...
...
@@ -303,7 +303,7 @@ static int32_t taosAddClientCfg(SConfig *pCfg) {
static
int32_t
taosAddSystemCfg
(
SConfig
*
pCfg
)
{
SysNameInfo
info
=
taosGetSysNameInfo
();
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
tsTimezone
)
!=
0
)
return
-
1
;
if
(
cfgAddTimezone
(
pCfg
,
"timezone"
,
tsTimezone
Str
)
!=
0
)
return
-
1
;
if
(
cfgAddLocale
(
pCfg
,
"locale"
,
tsLocale
)
!=
0
)
return
-
1
;
if
(
cfgAddCharset
(
pCfg
,
"charset"
,
tsCharset
)
!=
0
)
return
-
1
;
if
(
cfgAddBool
(
pCfg
,
"enableCoreFile"
,
1
,
1
)
!=
0
)
return
-
1
;
...
...
@@ -431,12 +431,13 @@ static int32_t taosSetClientCfg(SConfig *pCfg) {
static
void
taosSetSystemCfg
(
SConfig
*
pCfg
)
{
SConfigItem
*
pItem
=
cfgGetItem
(
pCfg
,
"timezone"
);
osSetTimezone
(
pItem
->
str
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
tsTimezone
);
cfgSetItem
(
pCfg
,
"timezone"
,
tsTimezone
,
pItem
->
stype
);
uDebug
(
"timezone format changed from %s to %s"
,
pItem
->
str
,
tsTimezone
Str
);
cfgSetItem
(
pCfg
,
"timezone"
,
tsTimezone
Str
,
pItem
->
stype
);
const
char
*
locale
=
cfgGetItem
(
pCfg
,
"locale"
)
->
str
;
const
char
*
charset
=
cfgGetItem
(
pCfg
,
"charset"
)
->
str
;
taosSetSystemLocale
(
locale
,
charset
);
osSetSystemLocale
(
locale
,
charset
);
bool
enableCore
=
cfgGetItem
(
pCfg
,
"enableCoreFile"
)
->
bval
;
taosSetConsoleEcho
(
enableCore
);
...
...
@@ -483,7 +484,7 @@ static int32_t taosSetServerCfg(SConfig *pCfg) {
int32_t
taosCreateLog
(
const
char
*
logname
,
int32_t
logFileNum
,
const
char
*
cfgDir
,
const
char
*
envFile
,
const
char
*
apolloUrl
,
SArray
*
pArgs
,
bool
tsc
)
{
osInit
();
os
Default
Init
();
SConfig
*
pCfg
=
cfgInit
();
if
(
pCfg
==
NULL
)
return
-
1
;
...
...
source/dnode/mgmt/dnode/src/dmMsg.c
浏览文件 @
c712e581
...
...
@@ -36,7 +36,7 @@ void dmSendStatusReq(SDnodeMgmt *pMgmt) {
req
.
clusterCfg
.
checkTime
=
0
;
char
timestr
[
32
]
=
"1970-01-01 00:00:00.00"
;
(
void
)
taosParseTime
(
timestr
,
&
req
.
clusterCfg
.
checkTime
,
(
int32_t
)
strlen
(
timestr
),
TSDB_TIME_PRECISION_MILLI
,
0
);
memcpy
(
req
.
clusterCfg
.
timezone
,
tsTimezone
,
TD_TIMEZONE_LEN
);
memcpy
(
req
.
clusterCfg
.
timezone
,
tsTimezone
Str
,
TD_TIMEZONE_LEN
);
memcpy
(
req
.
clusterCfg
.
locale
,
tsLocale
,
TD_LOCALE_LEN
);
memcpy
(
req
.
clusterCfg
.
charset
,
tsCharset
,
TD_LOCALE_LEN
);
taosRUnLockLatch
(
&
pMgmt
->
latch
);
...
...
source/dnode/mnode/impl/src/mndDnode.c
浏览文件 @
c712e581
...
...
@@ -277,8 +277,8 @@ static int32_t mndCheckClusterCfgPara(SMnode *pMnode, const SClusterCfg *pCfg) {
return
DND_REASON_STATUS_INTERVAL_NOT_MATCH
;
}
if
((
0
!=
strcasecmp
(
pCfg
->
timezone
,
tsTimezone
))
&&
(
pMnode
->
checkTime
!=
pCfg
->
checkTime
))
{
mError
(
"timezone [%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
tsTimezone
,
if
((
0
!=
strcasecmp
(
pCfg
->
timezone
,
tsTimezone
Str
))
&&
(
pMnode
->
checkTime
!=
pCfg
->
checkTime
))
{
mError
(
"timezone [%s - %s] [%"
PRId64
" - %"
PRId64
"] cfg inconsistent"
,
pCfg
->
timezone
,
tsTimezone
Str
,
pCfg
->
checkTime
,
pMnode
->
checkTime
);
return
DND_REASON_TIME_ZONE_NOT_MATCH
;
}
...
...
@@ -677,7 +677,7 @@ static int32_t mndRetrieveConfigs(SNodeMsg *pReq, SShowObj *pShow, char *data, i
totalRows
++
;
cfgOpts
[
totalRows
]
=
"timezone"
;
snprintf
(
cfgVals
[
totalRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
tsTimezone
);
snprintf
(
cfgVals
[
totalRows
],
TSDB_CONIIG_VALUE_LEN
,
"%s"
,
tsTimezone
Str
);
totalRows
++
;
cfgOpts
[
totalRows
]
=
"locale"
;
...
...
source/dnode/vnode/src/vnd/vnodeWrite.c
浏览文件 @
c712e581
...
...
@@ -176,7 +176,7 @@ int vnodeApplyWMsg(SVnode *pVnode, SRpcMsg *pMsg, SRpcMsg **pRsp) {
}
// record current timezone of server side
tstrncpy(vCreateSmaReq.tSma.timezone, tsTimezone, TD_TIMEZONE_LEN);
tstrncpy(vCreateSmaReq.tSma.timezone, tsTimezone
Str
, TD_TIMEZONE_LEN);
if (metaCreateTSma(pVnode->pMeta, &vCreateSmaReq) < 0) {
// TODO: handle error
...
...
source/os/src/osEnv.c
浏览文件 @
c712e581
...
...
@@ -18,30 +18,31 @@
extern
void
taosWinSocketInit
();
char
configDir
[
PATH_MAX
]
=
{
0
};
char
tsDataDir
[
PATH_MAX
]
=
{
0
};
char
tsLogDir
[
PATH_MAX
]
=
{
0
};
char
tsTempDir
[
PATH_MAX
]
=
{
0
};
SDiskSpace
tsDataSpace
=
{
0
};
SDiskSpace
tsLogSpace
=
{
0
};
SDiskSpace
tsTempSpace
=
{
0
};
char
tsOsName
[
16
]
=
{
0
};
char
tsTimezone
[
TD_TIMEZONE_LEN
]
=
{
0
};
char
tsLocale
[
TD_LOCALE_LEN
]
=
{
0
};
char
tsCharset
[
TD_CHARSET_LEN
]
=
{
0
};
int8_t
tsDaylight
=
0
;
bool
tsEnableCoreFile
=
0
;
int64_t
tsPageSizeKB
=
0
;
int64_t
tsOpenMax
=
0
;
int64_t
tsStreamMax
=
0
;
float
tsNumOfCores
=
0
;
int64_t
tsTotalMemoryKB
=
0
;
void
osInit
()
{
char
configDir
[
PATH_MAX
]
=
{
0
};
char
tsDataDir
[
PATH_MAX
]
=
{
0
};
char
tsLogDir
[
PATH_MAX
]
=
{
0
};
char
tsTempDir
[
PATH_MAX
]
=
{
0
};
SDiskSpace
tsDataSpace
=
{
0
};
SDiskSpace
tsLogSpace
=
{
0
};
SDiskSpace
tsTempSpace
=
{
0
};
char
tsOsName
[
16
]
=
{
0
};
char
tsTimezoneStr
[
TD_TIMEZONE_LEN
]
=
{
0
};
enum
TdTimezone
tsTimezone
=
TdZeroZero
;
char
tsLocale
[
TD_LOCALE_LEN
]
=
{
0
};
char
tsCharset
[
TD_CHARSET_LEN
]
=
{
0
};
int8_t
tsDaylight
=
0
;
bool
tsEnableCoreFile
=
0
;
int64_t
tsPageSizeKB
=
0
;
int64_t
tsOpenMax
=
0
;
int64_t
tsStreamMax
=
0
;
float
tsNumOfCores
=
0
;
int64_t
tsTotalMemoryKB
=
0
;
void
osDefaultInit
()
{
taosSeedRand
(
taosSafeRand
());
taosGetSystemLocale
(
tsLocale
,
tsCharset
);
taosGetSystemTimezone
(
tsTimezone
);
taosSetSystemTimezone
(
tsTimezone
,
tsTimezone
,
&
tsDaylight
);
taosGetSystemTimezone
(
tsTimezone
Str
,
&
tsTimezone
);
taosSetSystemTimezone
(
tsTimezone
Str
,
tsTimezoneStr
,
&
tsDaylight
,
&
tsTimezone
);
taosGetSystemInfo
();
// deadlock in query
...
...
@@ -105,4 +106,9 @@ void osCleanup() {}
bool
osLogSpaceAvailable
()
{
return
tsLogSpace
.
reserved
<=
tsLogSpace
.
size
.
avail
;
}
void
osSetTimezone
(
const
char
*
timezone
)
{
taosSetSystemTimezone
(
tsTimezone
,
tsTimezone
,
&
tsDaylight
);
}
void
osSetTimezone
(
const
char
*
timezone
)
{
taosSetSystemTimezone
(
timezone
,
tsTimezoneStr
,
&
tsDaylight
,
&
tsTimezone
);
}
void
osSetSystemLocale
(
const
char
*
inLocale
,
const
char
*
inCharSet
)
{
memcpy
(
tsLocale
,
inLocale
,
strlen
(
inLocale
)
+
1
);
memcpy
(
tsCharset
,
inCharSet
,
strlen
(
inCharSet
)
+
1
);
}
source/os/src/osMemory.c
浏览文件 @
c712e581
...
...
@@ -16,8 +16,6 @@
#define ALLOW_FORBID_FUNC
#include "os.h"
#define USE_TD_MEMORY
#define TD_MEMORY_SYMBOL ('T'<<24|'A'<<16|'O'<<8|'S')
#define TD_MEMORY_STACK_TRACE_DEPTH 10
...
...
@@ -47,16 +45,16 @@ int32_t taosBackTrace(void **buffer, int32_t size) {
int32_t
frame
=
0
;
void
**
ebp
;
void
**
ret
=
NULL
;
unsigned
long
long
func_frame_distance
=
0
;
size_t
func_frame_distance
=
0
;
if
(
buffer
!=
NULL
&&
size
>
0
)
{
ebp
=
taosGetEbp
();
func_frame_distance
=
(
unsigned
long
long
)(
*
ebp
)
-
(
unsigned
long
long
)
ebp
;
func_frame_distance
=
(
size_t
)
*
ebp
-
(
size_t
)
ebp
;
while
(
ebp
&&
frame
<
size
&&
(
func_frame_distance
<
(
1ULL
<<
24
))
// assume function ebp more than 16M
&&
(
func_frame_distance
>
0
))
{
ret
=
ebp
+
1
;
buffer
[
frame
++
]
=
*
ret
;
ebp
=
(
void
**
)(
*
ebp
);
func_frame_distance
=
(
unsigned
long
long
)(
*
ebp
)
-
(
unsigned
long
long
)
ebp
;
func_frame_distance
=
(
size_t
)
*
ebp
-
(
size_t
)
ebp
;
}
}
return
frame
;
...
...
source/os/src/osTimezone.c
浏览文件 @
c712e581
...
...
@@ -46,12 +46,22 @@
#include <unistd.h>
#endif
void
taosSetSystemTimezone
(
const
char
*
inTimezone
,
char
*
outTimezone
,
int8_t
*
outDaylight
)
{
if
(
inTimezone
==
NULL
||
inTimezone
[
0
]
==
0
)
return
;
void
taosSetSystemTimezone
(
const
char
*
inTimezoneStr
,
char
*
outTimezoneStr
,
int8_t
*
outDaylight
,
enum
TdTimezone
*
tsTimezone
)
{
if
(
inTimezoneStr
==
NULL
||
inTimezoneStr
[
0
]
==
0
)
return
;
char
*
buf
=
taosMemoryMalloc
(
strlen
(
inTimezoneStr
)
+
1
);
buf
[
strlen
(
inTimezoneStr
)]
=
0
;
for
(
int32_t
i
=
0
;
i
<
strlen
(
inTimezoneStr
);
i
++
)
{
if
(
inTimezoneStr
[
i
]
==
' '
||
inTimezoneStr
[
i
]
==
'('
)
{
buf
[
i
]
=
0
;
break
;
}
buf
[
i
]
=
inTimezoneStr
[
i
];
}
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
char
winStr
[
TD_LOCALE_LEN
*
2
];
sprintf
(
winStr
,
"TZ=%s"
,
inTimezone
);
sprintf
(
winStr
,
"TZ=%s"
,
buf
);
putenv
(
winStr
);
tzset
();
*
get
CURRENT
time
zone
.
...
...
@@ -70,44 +80,48 @@ void taosSetSystemTimezone(const char *inTimezone, char *outTimezone, int8_t *ou
#endif
int32_t
tz
=
(
int32_t
)((
-
timezone
*
MILLISECOND_PER_SECOND
)
/
MILLISECOND_PER_HOUR
);
*
tsTimezone
=
tz
;
tz
+=
daylight
;
/*
* format:
* (CST, +0800)
* (BST, +0100)
*/
sprintf
(
outTimezone
,
"(%s, %s%02d00)"
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
sprintf
(
outTimezone
Str
,
"%s (%s, %s%02d00)"
,
buf
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
*
outDaylight
=
daylight
;
#elif defined(_TD_DARWIN_64)
setenv
(
"TZ"
,
inTimezone
,
1
);
setenv
(
"TZ"
,
buf
,
1
);
tzset
();
int32_t
tz
=
(
int32_t
)((
-
timezone
*
MILLISECOND_PER_SECOND
)
/
MILLISECOND_PER_HOUR
);
*
tsTimezone
=
tz
;
tz
+=
daylight
;
sprintf
(
outTimezone
,
"(%s, %s%02d00)"
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
sprintf
(
outTimezone
Str
,
"%s (%s, %s%02d00)"
,
buf
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
*
outDaylight
=
daylight
;
#else
setenv
(
"TZ"
,
inTimezone
,
1
);
setenv
(
"TZ"
,
buf
,
1
);
tzset
();
int32_t
tz
=
(
int32_t
)((
-
timezone
*
MILLISECOND_PER_SECOND
)
/
MILLISECOND_PER_HOUR
);
*
tsTimezone
=
tz
;
tz
+=
daylight
;
sprintf
(
outTimezone
,
"(%s, %s%02d00)"
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
sprintf
(
outTimezone
Str
,
"%s (%s, %s%02d00)"
,
buf
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
*
outDaylight
=
daylight
;
#endif
taosMemoryFree
(
buf
);
}
void
taosGetSystemTimezone
(
char
*
outTimezone
)
{
void
taosGetSystemTimezone
(
char
*
outTimezone
Str
,
enum
TdTimezone
*
tsTimezone
)
{
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
char
*
tz
=
getenv
(
"TZ"
);
if
(
tz
==
NULL
||
strlen
(
tz
)
==
0
)
{
strcpy
(
outTimezone
,
"not configured"
);
strcpy
(
outTimezone
Str
,
"not configured"
);
}
else
{
strcpy
(
outTimezone
,
tz
);
strcpy
(
outTimezone
Str
,
tz
);
}
#elif defined(_TD_DARWIN_64)
...
...
@@ -153,7 +167,7 @@ void taosGetSystemTimezone(char *outTimezone) {
* Asia/Shanghai (CST, +0800)
* Europe/London (BST, +0100)
*/
snprintf
(
outTimezone
,
TD_TIMEZONE_LEN
,
"%s (%s, %+03ld00)"
,
tz
,
tm1
.
tm_isdst
?
tzname
[
daylight
]
:
tzname
[
0
],
snprintf
(
outTimezone
Str
,
TD_TIMEZONE_LEN
,
"%s (%s, %+03ld00)"
,
tz
,
tm1
.
tm_isdst
?
tzname
[
daylight
]
:
tzname
[
0
],
-
timezone
/
3600
);
#else
...
...
@@ -168,13 +182,14 @@ void taosGetSystemTimezone(char *outTimezone) {
/* load time zone string from /etc/timezone */
// FILE *f = fopen("/etc/timezone", "r");
errno
=
0
;
TdFilePtr
pFile
=
taosOpenFile
(
"/etc/timezone"
,
TD_FILE_READ
);
char
buf
[
68
]
=
{
0
};
if
(
pFile
!=
NULL
)
{
int
len
=
taosReadFile
(
pFile
,
buf
,
64
);
if
(
len
<
64
&&
taosGetErrorFile
(
pFile
))
{
taosCloseFile
(
&
pFile
);
//
printf("read /etc/timezone error, reason:%s", strerror(errno));
printf
(
"read /etc/timezone error, reason:%s"
,
strerror
(
errno
));
return
;
}
...
...
@@ -202,6 +217,7 @@ void taosGetSystemTimezone(char *outTimezone) {
* otherwise is GMT+00:00
*/
int32_t
tz
=
(
-
timezone
*
MILLISECOND_PER_SECOND
)
/
MILLISECOND_PER_HOUR
;
*
tsTimezone
=
tz
;
tz
+=
daylight
;
/*
...
...
@@ -210,7 +226,7 @@ void taosGetSystemTimezone(char *outTimezone) {
* Asia/Shanghai (CST, +0800)
* Europe/London (BST, +0100)
*/
snprintf
(
outTimezone
,
TD_TIMEZONE_LEN
,
"%s (%s, %s%02d00)"
,
buf
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
snprintf
(
outTimezone
Str
,
TD_TIMEZONE_LEN
,
"%s (%s, %s%02d00)"
,
buf
,
tzname
[
daylight
],
tz
>=
0
?
"+"
:
"-"
,
abs
(
tz
));
#endif
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录