-
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 with TZ offset causes incorrect UTC time #6921
Comments
I am facing the same issue. If I set a timezone as int using ConfigTime(int timezone_sec,...), the local clock gets offset the difference to UTC time. By now I am handling the timezones and clock resyncs by myself, and it works this way, but how do I prevent the auto-resync every hour? It is causing me problems. I tried setting SNTP_UPDATE_DELAY to 0 everywhere but it is still resyncing every hour by itself. Any clues? TIA |
And we can't do that apart from modifying the TZ variable ( I don't know how esp32 works regarding time management, but the new
If it's about esp8266/esp32 compatibility, please have a look to our |
#6993 removes espressif legacy time management. |
Thanks, @d-a-v, for the detailed explanation. configTime(0, 0, "pool.ntp.org", "time.nis.gov");
// Set timezone
setenv("TZ", TZ_STRING, 1); So, I'm looking forward for a release including PR #6993 to have this more simple. |
I don't see why we wouldn't have the same name. |
You are very kind, thanks. But, subjectively, I like more the way it is now (same name, overloaded) . ESP32 arduino seems to be less mature and it should be changed to be more compatible with ESP8266 arduino wherever possible. |
Thanks. I was not intending to remove the overload, but just add an alias. |
Well, for those who may need it: just call |
Basic Infos
Platform
Settings in IDE
Problem Description
When using the
void configTime(int timezone, int daylightOffset_sec, const char* server1, const char* server2 = nullptr, const char* server3 = nullptr)
with non-zero timezone offset to synchronize time, device doesn't differentiate between local and UTC time, where UTC time is wrongly set to local time.This works OK on ESP32 (1.0.4).
I've checked #6678, but it seems it is just about initialization issue.
The workaround is using
void configTime(const char* tz, const char* server1, const char* server2 = nullptr, const char* server3 = nullptr)
.MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: