set tz early

This commit is contained in:
2026-08-07 15:27:39 +02:00
parent d7dfc5f6c8
commit 0a56252f7e

View File

@@ -35,8 +35,6 @@ static void on_get_ip(void *arg, esp_event_base_t event_base, int32_t event_id,
sntp_set_time_sync_notification_cb(time_sync_notification_cb);
sntp_set_sync_interval(SNTP_TIME_SYNC_INTERVAL_MINUTES * 60 * 1000);
esp_sntp_setservername(0, SNTP_SERVER);
setenv("TZ", POSIX_TIMEZONE_STRING, true);
tzset();
esp_sntp_init();
}
@@ -122,8 +120,14 @@ static void on_scan_done(void *arg, esp_event_base_t event_base, int32_t event_i
try_next_hidden_network();
}
static void set_tz(void) {
setenv("TZ", POSIX_TIMEZONE_STRING, true);
tzset();
}
#if SOC_EMAC_SUPPORTED
void init_ethernet(const char *hostname) {
set_tz();
ESP_ERROR_CHECK(esp_netif_init());
uint8_t eth_port_cnt = 0;
@@ -147,6 +151,7 @@ void init_ethernet(const char *hostname) {
#endif
void init_wifi(const struct wifi_networks_t *nets, const char *hostname) {
set_tz();
nvs_flash_init();
esp_netif_init();
esp_netif_t *netif = esp_netif_create_default_wifi_sta();