Skip to content

Fixed so configTime will not crash if tcpip is not initialized #3470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cores/esp32/esp32-hal-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#include "esp32-hal.h"
#include "lwip/apps/sntp.h"
#include "tcpip_adapter.h"

static void setTimeZone(long offset, int daylight)
{
Expand Down Expand Up @@ -45,6 +46,7 @@ static void setTimeZone(long offset, int daylight)
* */
void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
{
tcpip_adapter_init(); // Should not hurt anything if already inited
if(sntp_enabled()){
sntp_stop();
}
Expand All @@ -62,6 +64,7 @@ void configTime(long gmtOffset_sec, int daylightOffset_sec, const char* server1,
* */
void configTzTime(const char* tz, const char* server1, const char* server2, const char* server3)
{
tcpip_adapter_init(); // Should not hurt anything if already inited
if(sntp_enabled()){
sntp_stop();
}
Expand Down