Go to the documentation of this file.
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';
56 for (i = 0; i < 12; i++)
65 if (tm->tm_sec < 0 || tm->tm_sec > 59)
67 if (tm->tm_min < 0 || tm->tm_min > 59)
69 if (tm->tm_hour < 0 || tm->tm_hour > 23)
71 if (tm->tm_mday < 1 || tm->tm_mday > 31)
73 if (tm->tm_mon < 0 || tm->tm_mon > 11)
80 const char *aTime,
const char *zone) {
83 memset(&tm, 0,
sizeof(tm));
85 if (!day || !month || !year || !aTime || (zone && strcmp(zone,
"GMT")))
87 tm.tm_mday = atoi(day);
91 tm.tm_year = atoi(year);
92 if (strlen(year) == 4)
94 else if (tm.tm_year < 70)
96 else if (tm.tm_year > 19000)
99 t = strchr(aTime,
':');
106 tm.tm_sec = atoi(t + 1);
115 char *wday =
nullptr;
117 char *month =
nullptr;
118 char *year =
nullptr;
119 char *timestr =
nullptr;
120 char *zone =
nullptr;
124 for (t = strtok(tmp,
", "); t; t = strtok(
nullptr,
", ")) {
138 }
else if (strchr(t,
':'))
171 #elif HAVE_TM_TM_GMTOFF
174 struct tm *local = localtime(&t);
175 t += local->tm_gmtoff;
182 #if !(defined(_TIMEZONE) || defined(_timezone) || _SQUID_AIX_ || _SQUID_WINDOWS_ || _SQUID_SGI_)
183 extern long timezone;
189 if (tm->tm_isdst > 0)
191 #if defined(_timezone) || _SQUID_WINDOWS_
192 t -= (_timezone + dst);
194 t -= (timezone + dst);
204 static char buf[128];
206 struct tm *gmt = gmtime(&t);
static int make_num(const char *s)
time_t ParseRfc1123(const char *)
Convert from RFC 1123 style time: "www, DD MMM YYYY hh:mm:ss ZZZ".
char * xstrncpy(char *dst, const char *src, size_t n)
static int make_month(const char *s)
const char * FormatRfc1123(time_t)
static struct tm * parse_date(const char *str)
static int tmSaneValues(struct tm *tm)
static struct tm * parse_date_elements(const char *day, const char *month, const char *year, const char *aTime, const char *zone)
static const char * month_names[12]