Comments (5)
There is an sntp example in esp-idf, you can it in Arduino as well.
On Sat, Nov 12, 2016, 08:28 lbernstone [email protected] wrote:
This depends on sntp.c, which in turn depends on lwip components that are
not working yet.—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#29 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEJcep2SGRmYZ3pwMDnrImvK5KgGyfk7ks5q9QhAgaJpZM4Kn5rM
.
from arduino-esp32.
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.
void init_time()
{
long int gmt_offset_sec = -25200;
int dst_offset_sec = 0;
configTime( gmt_offset_sec, dst_offset_sec , "pool.ntp.org" );
struct tm timeinfo;
if( !getLocalTime( &timeinfo, 2000 ) )
{
printf( "failed to obtain time\n" );
return;
}
time_t now;
printf( "%ld\n",time( &now ) );
}
void wifi_event_handler( WiFiEvent_t event )
{
printf("[WiFi-event] (%d)\n", event);
switch(event)
{
case SYSTEM_EVENT_STA_GOT_IP:
wifi_got_ip_addr = true;
break;
case SYSTEM_EVENT_STA_DISCONNECTED:
wifi_got_ip_addr = false;
break;
default:
break;
}
}
from arduino-esp32.
I init time on SYSTEM_EVENT_STA_GOT_IP and have no problems.
almost that same code above ;)
from arduino-esp32.
I do not see you calling init_time anywhere above
from arduino-esp32.
Not sure what I was doing wrong but it works now! Thanks.
from arduino-esp32.
Related Issues (20)
- Cookie jar can't work with session cookies
- Custom Partition in Board Configuration do not take FLASH Mode Size into account HOT 6
- Send UDP package to server, but server got UDP package with wrong size. HOT 3
- NimBLE support for ESP32-C6, H2 and future MCU's and why is Bluedroid still the default? HOT 1
- v3.0.0 detects / defaults to wrong XTAL frequency on ESP32-D0WDQ6-V3 - millis and UART baud are not correct HOT 9
- How to realize Chinese recognition of ESP-SR on ArduinoIDE HOT 13
- NetworkClient `localIP()` always returns `IPAddress(0,0,0,0)` HOT 1
- ESP32 Latest 3 series HOT 2
- Verify/Uplad throws error if username contains a special character HOT 3
- "Wrong Magic Byte" HTTP_Client_AES_OTA_Update HOT 4
- Query regarding esp-modbus. HOT 2
- Problem with the HA_temperature_sensor example - can't set a value which is shown in zigbee2mqtt HOT 1
- WiFi.setTxPower() always return +19.5dBm HOT 3
- HTTPClient should allow for setting own Accept-Encoding header HOT 2
- FlashMemory Address for EEPROM HOT 4
- Boot Loop When Enabling USB CDC On Boot with RMT Driver HOT 6
- ESP32 WiFiScan: no networks found HOT 4
- BluetoothSerial::flush() takes too long HOT 2
- printf compile "expects argument of type 'int'" warnings on IDF_VER 5.1 HOT 2
- Log strings visible in firmware.bin even if the CORE_DEBUG_LEVEL is set to 0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino-esp32.