-
Notifications
You must be signed in to change notification settings - Fork 7.6k
configTime() method not implemented #29
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
Comments
There is an sntp example in esp-idf, you can it in Arduino as well. On Sat, Nov 12, 2016, 08:28 lbernstone notifications@github.com wrote:
|
Hi, has anyone confirmed this works? I'm using this function, as called from my wifi_event_handler()'s SYSTEM_EVENT_STA_GOT_IP event. These calls are unsuccessful in getting time.
|
I init time on SYSTEM_EVENT_STA_GOT_IP and have no problems. |
I do not see you calling init_time anywhere above |
Not sure what I was doing wrong but it works now! Thanks. |
example: ```cpp //done once on WiFi init configTime(-7200, 3600, "pool.ntp.org"); //get local time struct tm timeinfo; if(!getLocalTime(&timeinfo)){ Serial.println("Failed to obtain time"); return; } //print time Serial.println(&timeinfo); //print time with different format Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); ``` fixes: espressif/arduino-esp32#29
* Use stable esp32 library * Fixes * Version bump + cleanup * Bump IDE version * Fix * Switch to old version for testing purposes * Switch back to newer version of IDE
example: ```cpp //done once on WiFi init configTime(-7200, 3600, "pool.ntp.org"); //get local time struct tm timeinfo; if(!getLocalTime(&timeinfo)){ Serial.println("Failed to obtain time"); return; } //print time Serial.println(&timeinfo); //print time with different format Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S"); ``` fixes: espressif/arduino-esp32#29
Porting over code from ESP8266 and hoping for an analog to time.c in the 8266 core
I was digging around in time.h but the types and pointers were out of my comfort zone.
Specifically configTime() was a very easy way to get the system clock synced with internet time.
The text was updated successfully, but these errors were encountered: