-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
configTime and time seem to ignore DST #2505
Comments
For me it's working okay. Try this:
The network needs some seconds to initialize the internal time. Obviously there is a fixed date when DST changes, On 12.09.2016 at 09:40 wrote tzapu:
|
ATM I have only an old ESP-01 with lots of jumpers... But I can confirm, parameter dst dosn't have any effect in the last SDK. This behavior has changed in the last time. I dont know when, but there On 12.09.2016 at 18:06 wrote Peter:
Am 12.09.2016 um 18:06 schrieb Peter Dobler:
|
I am also experiencing this same behaviour. DST is not being taken into account. |
Same problem here. I just adjusted the timezone by 1 hr to account for it. Seems like at least in time.c this variable gets set and never used again. s_daylightOffset_sec = daylightOffset_sec; Granted I haven't looked deeper into the code. |
I still see the code referenced in the previous comment in latest git: the static variable s_daylightOffset_sec |
As long as there is no function in the SDK to set DST, sntp_get_current_timestamp will only be correct in Shanghai. :-) |
A quick search for "s_daylightOffset_sec" in the repository https://github.com/esp8266/Arduino/search?utf8=%E2%9C%93&q=s_daylightOffset_sec&type= shows DST it is still not used. An interesting function in ../core/sntp.c is: that seems to write the ESP8266 RTC memory, being RTC_DST_SET defined as: However, I haven't found where sntp_set_daylight is invoked. By the way, some native (i.e., system_) functions seem interesting: `#include <time.h> #ifdef ESP8266 uint32 thetime, RTCtime, RTCcali; void setup() { void loop() { now = time(nullptr); Serial.print("time(): "); Serial.print("system_get_time(): "); /*If system_get_rtc_time returns 10 (it means 10 RTC cycles), and Serial.print("system_rtc_clock_cali_proc(): "); Serial.print("mul: "); delay(1000); |
Juppit mentions: while(!this_second) That is not a good test. this_second will be set to nonzero the first time time(&this_second) is executed regardless of the SNTP code. Something like this is more of a starting point if you set the global variables appropriately. void configTime(-5 * 3600, 3600, "pool.ntp.org", "time.nist.gov", "time.windows.com"); In setup() In loop() Or simply wait for the configTime() call to finish doing its thing. |
DST offset doesn't work for me too. |
Yeah, this is also happening for me. DST is completely ignored. |
SNTP support and example have receive updates, and this thread is old. Current code allows to update sntp startup and update time,
|
Basic Infos
configTime and time seem to ignore DST
Hardware
Hardware: ESP-12
Core Version: latest master
Description
doing a config time, with DST offset does not seem to be actually doing anything to returned time. Time zone offset applies alone.
Sketch
Debug Messages
Expected GMT + 3 to be printed. It actually prints GMT + 2
Cheers
The text was updated successfully, but these errors were encountered: