Просмотр исходного кода

Set time zone even when NTP is disabled

setTimeZone() was only called inside the useNtp branch, so with an empty
TimeServer setting the configured TimeZone was never applied and all
local times were shown in UTC.
Argetlam 1 месяц назад
Родитель
Сommit
4a43d0ac16
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      code/components/jomjol_time_sntp/time_sntp.cpp

+ 2 - 2
code/components/jomjol_time_sntp/time_sntp.cpp

@@ -278,10 +278,10 @@ bool setupTime() {
         esp_sntp_config_t config = ESP_NETIF_SNTP_DEFAULT_CONFIG(timeServer.c_str());
         config.sync_cb = time_sync_notification_cb;
         esp_netif_sntp_init(&config);
-
-        setTimeZone(timeZone);
     }
 
+    setTimeZone(timeZone);
+
     /* The RTC keeps the time after a restart (Except on Power On or Pin Reset) 
      * There should only be a minor correction through NTP */