Browse Source

fetch time from ntp in germany

main
Hendrik Langer 5 years ago
parent
commit
45ab712632
  1. 6
      src/network/XD0OTA.cpp

6
src/network/XD0OTA.cpp

@ -14,7 +14,7 @@ XD0OTA::XD0OTA(String deviceName) : deviceName{deviceName} {}
// Set time via NTP, as required for x.509 validation
void XD0OTA::setClock() {
configTime(0, 0, "pool.ntp.org", "time.nist.gov"); // UTC
configTime(0, 0, "de.pool.ntp.org", "time.nist.gov"); // UTC
Serial.print(F("Waiting for NTP time sync: "));
time_t now = time(nullptr);
@ -33,6 +33,10 @@ void XD0OTA::setClock() {
gmtime_r(&now, &timeinfo);
Serial.print(F("Current time: "));
Serial.print(asctime(&timeinfo));
// setenv("TZ", "CET-1CEST,M3.5.0/2,M10.5.0/3", 1);
// tzset();
// localtime_r(&now, &timeinfo);
}
String XD0OTA::getMAC() {

Loading…
Cancel
Save