comparison src/core/ngx_times.c @ 409:8ac40cae79f0

nginx-0.0.10-2004-08-29-07:55:41 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 29 Aug 2004 03:55:41 +0000
parents 80e72c428b39
children 9a97dcdd2421
comparison
equal deleted inserted replaced
408:d6e2b445c1b8 409:8ac40cae79f0
212 ngx_tm_t tm; 212 ngx_tm_t tm;
213 213
214 ngx_gmtime(t, &tm); 214 ngx_gmtime(t, &tm);
215 215
216 return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"), 216 return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
217 "%s, %02d %s %4d %02d:%02d:%02d GMT", 217 "%s, %02d %s %4d %02d:%02d:%02d GMT",
218 week[tm.ngx_tm_wday], 218 week[tm.ngx_tm_wday],
219 tm.ngx_tm_mday, 219 tm.ngx_tm_mday,
220 months[tm.ngx_tm_mon - 1], 220 months[tm.ngx_tm_mon - 1],
221 tm.ngx_tm_year, 221 tm.ngx_tm_year,
222 tm.ngx_tm_hour, 222 tm.ngx_tm_hour,
223 tm.ngx_tm_min, 223 tm.ngx_tm_min,
224 tm.ngx_tm_sec); 224 tm.ngx_tm_sec);
225 }
226
227
228 size_t ngx_http_cookie_time(u_char *buf, time_t t)
229 {
230 ngx_tm_t tm;
231
232 ngx_gmtime(t, &tm);
233
234 /*
235 * Netscape 3.x does not understand 4-digit years at all and
236 * 2-digit years more than "37"
237 */
238
239 if (tm.ngx_tm_year > 2037) {
240 return ngx_snprintf((char *) buf,
241 sizeof("Mon, 28-Sep-1970 06:00:00 GMT"),
242 "%s, %02d-%s-%d %02d:%02d:%02d GMT",
243 week[tm.ngx_tm_wday],
244 tm.ngx_tm_mday,
245 months[tm.ngx_tm_mon - 1],
246 tm.ngx_tm_year,
247 tm.ngx_tm_hour,
248 tm.ngx_tm_min,
249 tm.ngx_tm_sec);
250 } else {
251 return ngx_snprintf((char *) buf,
252 sizeof("Mon, 28-Sep-70 06:00:00 GMT"),
253 "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
254 week[tm.ngx_tm_wday],
255 tm.ngx_tm_mday,
256 months[tm.ngx_tm_mon - 1],
257 tm.ngx_tm_year % 100,
258 tm.ngx_tm_hour,
259 tm.ngx_tm_min,
260 tm.ngx_tm_sec);
261 }
225 } 262 }
226 263
227 264
228 void ngx_gmtime(time_t t, ngx_tm_t *tp) 265 void ngx_gmtime(time_t t, ngx_tm_t *tp)
229 { 266 {