未验证 提交 22d98178 编写于 作者: O openharmony_ci 提交者: Gitee

!657 read tzzone from system param

Merge pull request !657 from haotuo/cherry-pick-1667906613
......@@ -21,6 +21,10 @@
#include "libc.h"
#include "lock.h"
#include "time_impl.h"
#ifdef OHOS_ENABLE_PARAMETER
#include "sys_param.h"
#define SYSPARAM_LENGTH 40
#endif
#define __TZ_VERSION__ '2'
......@@ -152,7 +156,18 @@ static void do_tzset()
s = getenv("TZ");
if (!s) {
#ifdef OHOS_ENABLE_PARAMETER
uint32_t tz_param_value_len = SYSPARAM_LENGTH;
char tz_param_value[SYSPARAM_LENGTH + 1] = {0};
if (SystemReadParam("persist.time.timezone", tz_param_value, &tz_param_value_len) == 0) {
tz_param_value[tz_param_value_len] = 0;
s = tz_param_value;
} else {
s = "/etc/localtime";
}
#else
s = "/etc/localtime";
#endif
}
if (!*s) {
s = __utc;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册