-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
hello i added a function to set the time from a time struct tm which is usefull when you get time from an NPT server.
add this to ESP32Time.cpp
void ESP32Time::setTimeStruct(tm t) { time_t timeSinceEpoch = mktime(&t); setTime(timeSinceEpoch, 0); }
and ESPTime.h
void setTimeStruct(tm t);
usage:
/* ----------------------------Initialize and get NPT Time-------------------------- */ configTime(gmtOffset_sec, daylightOffset_sec, ntpServer); struct tm timeinfo; if (getLocalTime(&timeinfo)) { rtc.setTimeStruct(timeinfo); }
Hope this helps!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels