20#define RFC850_STRFTIME "%A, %d-%b-%y %H:%M:%S GMT"
21#define RFC1123_STRFTIME "%a, %d %b %Y %H:%M:%S GMT"
27 "Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
28 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
34 if (*s >=
'0' && *s <=
'9')
35 return 10 * (*s -
'0') + *(s + 1) -
'0';
37 return *(s + 1) -
'0';
50 for (i = 0; i < 12; i++)
59 if (tm->tm_sec < 0 || tm->tm_sec > 59)
61 if (tm->tm_min < 0 || tm->tm_min > 59)
63 if (tm->tm_hour < 0 || tm->tm_hour > 23)
65 if (tm->tm_mday < 1 || tm->tm_mday > 31)
67 if (tm->tm_mon < 0 || tm->tm_mon > 11)
74 const char *aTime,
const char *zone) {
77 memset(&tm, 0,
sizeof(tm));
79 if (!day || !month || !year || !aTime || (zone && strcmp(zone,
"GMT")))
81 tm.tm_mday = atoi(day);
85 tm.tm_year = atoi(year);
86 if (strlen(year) == 4)
88 else if (tm.tm_year < 70)
90 else if (tm.tm_year > 19000)
93 t = strchr(aTime,
':');
100 tm.tm_sec = atoi(t + 1);
109 char *wday =
nullptr;
111 char *month =
nullptr;
112 char *year =
nullptr;
113 char *timestr =
nullptr;
114 char *zone =
nullptr;
118 for (t = strtok(tmp,
", "); t; t = strtok(
nullptr,
", ")) {
132 }
else if (strchr(t,
':'))
165#elif HAVE_TM_TM_GMTOFF
168 struct tm *local = localtime(&t);
169 t += local->tm_gmtoff;
176#if !(defined(_TIMEZONE) || defined(_timezone) || _SQUID_AIX_ || _SQUID_WINDOWS_ || _SQUID_SGI_)
177 extern long timezone;
183 if (tm->tm_isdst > 0)
185#if defined(_timezone) || _SQUID_WINDOWS_
186 t -= (_timezone + dst);
188 t -= (timezone + dst);
198 static char buf[128];
200 struct tm *gmt = gmtime(&t);
time_t ParseRfc1123(const char *)
Convert from RFC 1123 style time: "www, DD MMM YYYY hh:mm:ss ZZZ".
const char * FormatRfc1123(time_t)
static struct tm * parse_date(const char *str)
static struct tm * parse_date_elements(const char *day, const char *month, const char *year, const char *aTime, const char *zone)
static int make_month(const char *s)
static int tmSaneValues(struct tm *tm)
static int make_num(const char *s)
static const char * month_names[12]
char * xstrncpy(char *dst, const char *src, size_t n)