MCPcopy Create free account
hub / github.com/OpenEPaperLink/OpenEPaperLink / formatUtcToLocal

Function formatUtcToLocal

ESP32_AP-Flasher/src/contentmanager.cpp:846–863  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

844}
845
846String formatUtcToLocal(const String &s) {
847 int h, m, ss = 0;
848 if (sscanf(s.c_str(), "%d:%d:%d", &h, &m, &ss) < 2 || h > 23 || m > 59 || ss > 59)
849 return "-";
850
851 time_t n = time(nullptr);
852 struct tm tm = *localtime(&n);
853 tm.tm_hour = h;
854 tm.tm_min = m;
855 tm.tm_sec = ss;
856
857 time_t utc = mktime(&tm) - _timezone + (tm.tm_isdst ? 3600 : 0);
858 localtime_r(&utc, &tm);
859
860 char buf[6];
861 snprintf(buf, 6, "%02d:%02d", tm.tm_hour, tm.tm_min);
862 return buf;
863}
864
865void drawDate(String &filename, JsonObject &cfgobj, tagRecord *&taginfo, imgParam &imageParams) {
866 time_t now;

Callers 1

drawDateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected