mirror of
https://github.com/IoTManagerProject/IoTManager.git
synced 2026-03-26 14:12:16 +03:00
21 lines
357 B
C++
21 lines
357 B
C++
#ifdef ESP32
|
|
|
|
void Time_Init() {
|
|
|
|
//init and get the time
|
|
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
|
|
printLocalTime();
|
|
|
|
}
|
|
|
|
void printLocalTime() {
|
|
struct tm timeinfo;
|
|
if (!getLocalTime(&timeinfo)) {
|
|
Serial.println("[E] Failed to obtain time");
|
|
return;
|
|
}
|
|
Serial.println(&timeinfo, "[V] %A, %B %d %Y %H:%M:%S");
|
|
}
|
|
|
|
#endif
|