mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-29 18:27:15 +02:00
add configTime, getLocalTime and support for time in Print
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: https://github.com/espressif/arduino-esp32/issues/29
This commit is contained in:
@ -162,6 +162,10 @@ uint16_t makeWord(byte h, byte l);
|
||||
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
|
||||
|
||||
extern "C" bool getLocalTime(struct tm * info, uint32_t ms = 5000);
|
||||
extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
|
||||
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
|
||||
|
||||
// WMath prototypes
|
||||
long random(long);
|
||||
#endif /* __cplusplus */
|
||||
|
Reference in New Issue
Block a user