Skip to content

Commit 9ed57a0

Browse files
authored
Update time.cpp
Migrate configTime() to use sntp_set_timezone_in_seconds() to correctly allow timezone spec in seconds without rounding
1 parent 418857a commit 9ed57a0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cores/esp8266/time.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ static void setServer(int id, const char* name_or_ip)
5858
}
5959
}
6060

61-
void configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
61+
62+
void configTime(int timezone_sec, int daylightOffset_sec, const char* server1, const char* server2, const char* server3)
6263
{
6364
sntp_stop();
6465

6566
setServer(0, server1);
6667
setServer(1, server2);
6768
setServer(2, server3);
6869

69-
sntp_set_timezone(timezone/3600);
70+
sntp_set_timezone_in_seconds(timezone_sec);
7071
sntp_set_daylight(daylightOffset_sec);
7172
sntp_init();
7273
}

0 commit comments

Comments
 (0)