Skip to content

Commit

Permalink
Fixed so configTime will not crash if tcpip is not initialized (#3470)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbernstone authored and me-no-dev committed Nov 11, 2019
1 parent 8c4ca5a commit f41beb9
Showing 1 changed file with 3 additions and 0 deletions.
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

0 comments on commit f41beb9

Please sign in to comment.