You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
configTime function (Time.c) supports timezone definition is given in seconds. But sntp_set_timezone(sint8 timezone) in sntp-lwip2.c requires time zone in hours. This is fault because there exsist other timezones then full hours also.
Please change sntp_set_timezone function to accept second based timezone, and validate zone using second values if(timezone >= -113600 || timezone <= 133600)
Dayligt savint time setup sntp_set_daylight(...) seems to use second values correctrly
#include<Arduino.h>voidsetup() {
// Setup Wifi connection// Set TimeZone 5h 30minint timeZoneH 5;
int timeZoneM 30;
configTime((timeZoneH*60+timeZoneM)*60, 0, "pool.ntp.org", "time.nist.gov");
time(nullptr);
}
voidloop() {
time_t now = time(nullptr);
tm* t = localtime(&now);
// returned time is not in correct timezone 5h30min...
}
The text was updated successfully, but these errors were encountered:
I would like to point out that a few are :45 off the full hour, and that historically there has been instances of higher precision than 15min, for example +01:24, +04:51 and -00:25:21 (second precision no less).
None of the odd non-15min increments are in use today as far as I can tell, but it would probably be best with at least minute precision for time zones.
I would like to point out that a few are :45 off the full hour, and that historically there has been instances of higher precision than 15min, for example +01:24, +04:51 and -00:25:21 (second precision no less).
None of the odd non-15min increments are in use today as far as I can tell, but it would probably be best with at least minute precision for time zones.
yes that why I suggested to use seconds value like in configTime interface function uses and not convert to hours/minutes
Please test #5828 , it adds sntp_set_timezone_in_seconds(). You may have to extern sntp_set_timezone_in_seconds(sint32 timezone);
at the top of your sketch, because the function signature isn't in a .h yet. Also, configTime() isn't updated either.
Basic Infos
Platform
Settings in IDE
Problem Description
configTime function (Time.c) supports timezone definition is given in seconds. But sntp_set_timezone(sint8 timezone) in sntp-lwip2.c requires time zone in hours. This is fault because there exsist other timezones then full hours also.
Please change sntp_set_timezone function to accept second based timezone, and validate zone using second values if(timezone >= -113600 || timezone <= 133600)
Dayligt savint time setup sntp_set_daylight(...) seems to use second values correctrly
MCVE Sketch
The text was updated successfully, but these errors were encountered: