MCPcopy Create free account
hub / github.com/catboost/catboost / format_http_date

Function format_http_date

library/cpp/http/misc/httpdate.cpp:52–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50};
51
52int format_http_date(char buf[], size_t size, time_t when) {
53 struct tm tms;
54 GmTimeR(&when, &tms);
55
56#ifndef HTTP_DATE_ISO_8601
57 return snprintf(buf, size, "%s, %02d %s %04d %02d:%02d:%02d GMT",
58 wkdays[tms.tm_wday], tms.tm_mday, months[tms.tm_mon],
59 tms.tm_year + 1900, tms.tm_hour, tms.tm_min, tms.tm_sec);
60#else /* ISO 8601 */
61 return snprintf(buf, size, "%04d%02d%02dT%02d%02d%02d+0000",
62 tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
63 tms.tm_hour, tms.tm_min, tms.tm_sec);
64#endif
65}
66
67char* format_http_date(time_t when, char* buf, size_t buflen) {
68 const int len = format_http_date(buf, buflen, when);

Callers 2

Y_UNIT_TESTFunction · 0.85
FormatHttpDateFunction · 0.85

Calls 2

GmTimeRFunction · 0.85
snprintfFunction · 0.50

Tested by

no test coverage detected