[Bugfix][T106BUG-329]fixed not change time according to the time zone when synchronizing time using rtc
Only Configure:No
Affected branch:master
Affected module:systime
Is it affected on both ZXIC and MTK:only ZXIC
Self-test:Yes
Doc Update:NO
Change-Id: I0d0f4e0a151c323dfa45277d66bf47dab36535b6
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
index 67bc631..3ad792c 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
@@ -65,6 +65,7 @@
extern int sc_cfg_get(char *name, char* buf, int bufLen);
extern int sc_cfg_set (char *name, char *value);
+
char sync_from_rtc_cb_flag = 1;
char rtc_time_get_cb_flag = 1;
static unsigned long s_rtc_sec = 0;
@@ -79,11 +80,20 @@
time_t tmp = 0;
char command[100] = "";
tmp = (time_t)ulsec;
+ //xy.he add for T106BUG-329 2023-12-13 start
rtc_time = *localtime(&tmp);
-
LYINFLOG("RTC time now is: %d-%d-%d,%d:%d:%d\n",
rtc_time.tm_year + 1900, rtc_time.tm_mon + 1, rtc_time.tm_mday, rtc_time.tm_hour, rtc_time.tm_min, rtc_time.tm_sec);
- snprintf(command, sizeof(command), "date --set=\'@%lu\' ", ulsec);
+ //set timezone
+ tzset();
+ printf("timezone = %d\n",timezone);
+ //Change the time according to the time zone
+ tmp = tmp - timezone;
+ rtc_time = *localtime(&tmp);
+ LYINFLOG("Local time now is: %d-%d-%d,%d:%d:%d\n",
+ rtc_time.tm_year + 1900, rtc_time.tm_mon + 1, rtc_time.tm_mday, rtc_time.tm_hour, rtc_time.tm_min, rtc_time.tm_sec);
+ snprintf(command, sizeof(command), "date --set=\'@%lu\' ", tmp);
+ //xy.he add for T106BUG-329 2023-12-13 end
int ret = system(command);
if (ret != 0)
{