Ntp Sumertime changes at the Amerikan Date

JonaB111
Posts: 3
Joined: Sun Mar 14, 2021 4:33 pm

Ntp Sumertime changes at the Amerikan Date

Postby JonaB111 » Sun Mar 14, 2021 4:39 pm

Hello, on my Esp32 clock the time change today to summertime. However this should happen at the 28.3 not at the 14.3 in Germany. Im using Esp32's time Lib and i don't know how to change it.
Thanks for every Help!

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Ntp Sumertime changes at the Amerikan Date

Postby ESP_Sprite » Mon Mar 15, 2021 4:02 am

Esp32's time Lib
No such thing, you're probably using a 3rd party lib, one from a different SDK, or the ESP-IDF POSIX built-in functions. In case of the last, refer to the manual. In case you don't use that, please specify what you do use.

JonaB111
Posts: 3
Joined: Sun Mar 14, 2021 4:33 pm

Re: Ntp Sumertime changes at the Amerikan Date

Postby JonaB111 » Mon Mar 15, 2021 12:14 pm

Honestly I am a bit confused, what im using, because i use the one which comes with the esp32 i just include time.h and the functions are the same like in ESP-IDF POSIX but the ntp syncronization is done differently. I folowed the guide on https://randomnerdtutorials.com/esp32-d ... r-arduino/

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Ntp Sumertime changes at the Amerikan Date

Postby WiFive » Mon Mar 15, 2021 5:02 pm

The arduino function configTime does not let you set the dst rule and so defaults to US rule

ESP_Sprite
Posts: 9746
Joined: Thu Nov 26, 2015 4:08 am

Re: Ntp Sumertime changes at the Amerikan Date

Postby ESP_Sprite » Tue Mar 16, 2021 3:18 am

However, I think you should still be able to set the timezone using the TZ variable; refer to the manual page I linked earlier. Specifically, something like

Code: Select all

// Set timezone to China Standard Time
setenv("TZ", "CST-8", 1);
tzset()
and then using 'localtime' to get the time should work.

Who is online

Users browsing this forum: Baidu [Spider] and 65 guests