1.My code
time_t t = time(NULL);
struct tm tm = *localtime(&t);
LOG(LL_INFO, ("##Year : %d",tm.tm_year + 1900));
LOG(LL_INFO, ("##Month: %02d",tm.tm_mon + 1));
LOG(LL_INFO, ("##Day : %02d",tm.tm_mday));
LOG(LL_INFO, ("##Hour : %02d",tm.tm_hour));
LOG(LL_INFO, ("##Min : %02d",tm.tm_min));
LOG(LL_INFO, ("##Sec : %02d",tm.tm_sec));
- Logs after set TZ to Asia/Bangkok by mos tools and after software reset.
2.1
2.2
[Sep 23 11:19:53.512] mgos_deps_init.c:595 Init zip-tools 0.1 (86c413b05916f27b75172966aff51e7c78672a2b)...
[Sep 23 11:19:53.512] mgos_deps_init.c:595 Init timezones 0.2 (afeab05eaa81fb2354bc02f8a1840dffb334adc2)...
[Sep 23 11:19:53.512] mgos_timezones.c:121 Timezone init - checking for key ...
[Sep 23 11:19:53.512] mgos_timezones.c:128 Timezone init - olson: <Asia/Bangkok>
[Sep 23 11:19:53.512] mgos_timezones.c:131 Timezone init - dataPath: <>
[Sep 23 11:19:53.512] mgos_timezones.c:133 Timezone init - archFile: <tz-archive.zip>
[Sep 23 11:19:53.512] mgos_timezones.c:135 Timezone init - groupFile: <asia-tz.min.json>
- After sync TZ. Actually current times must be 11.26 AM.
[Sep 23 11:26:07.963] main.cpp:837 WiFi STA connected 0x0
[Sep 23 11:26:07.963] mgos_event.c:135 ev WFI2 triggered 1 handlers
[Sep 23 11:26:07.963] mgos_wifi_sta.c:422 State 7 ev 1464224003 timeout 0
[Sep 23 11:26:07.963] main.cpp:840 WiFi STA IP acquired 0x0
[Sep 23 11:26:07.963] mgos_event.c:135 ev WFI3 triggered 1 handlers
[Sep 23 11:26:07.963] mgos_net.c:93 WiFi STA: connected
[Sep 23 11:26:07.963] main.cpp:810 Net connected
[Sep 23 11:26:07.963] mgos_event.c:135 ev NET2 triggered 4 handlers
[Sep 23 11:26:07.963] main.cpp:393 ##Year : 2021
[Sep 23 11:26:07.963] main.cpp:394 ##Month: 09
[Sep 23 11:26:07.963] main.cpp:395 ##Day : 23
[Sep 23 11:26:07.963] main.cpp:396 ##Hour : 00
[Sep 23 11:26:07.963] main.cpp:397 ##Min : 26
[Sep 23 11:26:07.963] main.cpp:398 ##Sec : 07
- Log after hardware reset and sync TZ. Current times is correct.
[Sep 23 11:27:59.132] mgos_sntp.c:64 SNTP reply from 216.239.35.4: time 1632371279.526521, local 21.757706, delta 1632371257.768815
[Sep 23 11:27:59.132] mgos_event.c:135 ev MOS3 triggered 3 handlers
[Sep 23 11:27:59.132] mgos_sntp.c:146 SNTP next query in 7278890 ms
[Sep 23 11:27:59.132] main.cpp:393 ##Year : 2021
[Sep 23 11:27:59.132] main.cpp:394 ##Month: 09
[Sep 23 11:27:59.132] main.cpp:395 ##Day : 23
[Sep 23 11:27:59.132] main.cpp:396 ##Hour : 11
[Sep 23 11:27:59.132] main.cpp:397 ##Min : 27
[Sep 23 11:27:59.132] main.cpp:398 ##Sec : 59