MCPcopy Create free account
hub / github.com/cppla/ServerStatus / ParseOpenSSLEnddate

Function ParseOpenSSLEnddate

server/src/main.cpp:20–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18static volatile int gs_ReloadConfig = 0;
19
20static int64_t ParseOpenSSLEnddate(const char *line)
21{
22 // line format: notAfter=Aug 12 23:59:59 2025 GMT
23 const char *p = strstr(line, "notAfter=");
24 if(!p) return 0;
25 p += 9;
26 struct tm tmv; memset(&tmv,0,sizeof(tmv));
27 char month[4]={0};
28 int day, hour, min, sec, year;
29 if(sscanf(p, "%3s %d %d:%d:%d %d GMT", month, &day, &hour, &min, &sec, &year)!=6) return 0;
30 const char *months="JanFebMarAprMayJunJulAugSepOctNovDec";
31 const char *mpos = strstr(months, month);
32 if(!mpos) return 0;
33 int mon = (int)((mpos - months)/3);
34 tmv.tm_year = year - 1900;
35 tmv.tm_mon = mon;
36 tmv.tm_mday = day;
37 tmv.tm_hour = hour; tmv.tm_min = min; tmv.tm_sec = sec;
38 time_t t = timegm(&tmv);
39 return (int64_t)t;
40}
41
42struct SSLCheckThreadData { CMain *pMain; };
43static void SSLCheckThread(void *pUser)

Callers 1

SSLCheckThreadFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected