diff --git a/cores/esp8266/sntp-lwip2.cpp b/cores/esp8266/sntp-lwip2.cpp index 5edfa66c6..0dba9a7f8 100644 --- a/cores/esp8266/sntp-lwip2.cpp +++ b/cores/esp8266/sntp-lwip2.cpp @@ -433,9 +433,8 @@ bool sntp_set_timezone_in_seconds(sint32 timezone) if(timezone >= (-11 * (60 * 60)) || timezone <= (13 * (60 * 60))) { time_zone = timezone; return true; - } else { - return false; } + return false; } /* Sets the timezone in hours. Internally, the timezone is converted to seconds. */ diff --git a/cores/esp8266/sntp-lwip2.h b/cores/esp8266/sntp-lwip2.h new file mode 100644 index 000000000..5ae697754 --- /dev/null +++ b/cores/esp8266/sntp-lwip2.h @@ -0,0 +1,10 @@ +#ifndef __sntp_lwip2_h__ +#define __sntp_lwip2_h__ + +extern "C" { + +bool sntp_set_timezone_in_seconds(sint32 timezone); + +} + +#endif diff --git a/cores/esp8266/time.cpp b/cores/esp8266/time.cpp index d8391c420..001b0ec33 100644 --- a/cores/esp8266/time.cpp +++ b/cores/esp8266/time.cpp @@ -22,6 +22,8 @@ #include "sntp.h" #include "coredecls.h" +#include "sntp-lwip2.h" + extern "C" { #ifndef _TIMEVAL_DEFINED @@ -58,7 +60,8 @@ static void setServer(int id, const char* name_or_ip) } } -void configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2, const char* server3) + +void configTime(int timezone_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3) { sntp_stop(); @@ -66,7 +69,7 @@ void configTime(int timezone, int daylightOffset_sec, const char* server1, const setServer(1, server2); setServer(2, server3); - sntp_set_timezone(timezone/3600); + sntp_set_timezone_in_seconds(timezone_sec); sntp_set_daylight(daylightOffset_sec); sntp_init(); }