comparison src/core/ngx_times.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 4b2dafa26fe2
children 6f8b0dc0f8dd
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
92 92
93 ngx_start_msec = (ngx_epoch_msec_t) tv.tv_sec * 1000 + tv.tv_usec / 1000; 93 ngx_start_msec = (ngx_epoch_msec_t) tv.tv_sec * 1000 + tv.tv_usec / 1000;
94 ngx_old_elapsed_msec = 0; 94 ngx_old_elapsed_msec = 0;
95 ngx_elapsed_msec = 0; 95 ngx_elapsed_msec = 0;
96 96
97 #if !(WIN32) 97 #if !(NGX_WIN32)
98 tzset(); 98 tzset();
99 #endif 99 #endif
100 100
101 ngx_time_update(tv.tv_sec); 101 ngx_time_update(tv.tv_sec);
102 } 102 }
148 ngx_gmtime(s, &ngx_cached_gmtime); 148 ngx_gmtime(s, &ngx_cached_gmtime);
149 149
150 150
151 p = cached_http_time[slot]; 151 p = cached_http_time[slot];
152 152
153 ngx_snprintf((char *) p, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"), 153 ngx_sprintf(p, "%s, %02d %s %4d %02d:%02d:%02d GMT",
154 "%s, %02d %s %4d %02d:%02d:%02d GMT", 154 week[ngx_cached_gmtime.ngx_tm_wday],
155 week[ngx_cached_gmtime.ngx_tm_wday], 155 ngx_cached_gmtime.ngx_tm_mday,
156 ngx_cached_gmtime.ngx_tm_mday, 156 months[ngx_cached_gmtime.ngx_tm_mon - 1],
157 months[ngx_cached_gmtime.ngx_tm_mon - 1], 157 ngx_cached_gmtime.ngx_tm_year,
158 ngx_cached_gmtime.ngx_tm_year, 158 ngx_cached_gmtime.ngx_tm_hour,
159 ngx_cached_gmtime.ngx_tm_hour, 159 ngx_cached_gmtime.ngx_tm_min,
160 ngx_cached_gmtime.ngx_tm_min, 160 ngx_cached_gmtime.ngx_tm_sec);
161 ngx_cached_gmtime.ngx_tm_sec);
162 161
163 ngx_cached_http_time.data = p; 162 ngx_cached_http_time.data = p;
164 163
165 164
166 #if (HAVE_GETTIMEZONE) 165 #if (HAVE_GETTIMEZONE)
181 #endif 180 #endif
182 181
183 182
184 p = cached_err_log_time[slot]; 183 p = cached_err_log_time[slot];
185 184
186 ngx_snprintf((char *) p, sizeof("1970/09/28 12:00:00"), 185 ngx_sprintf(p, "%4d/%02d/%02d %02d:%02d:%02d",
187 "%4d/%02d/%02d %02d:%02d:%02d", 186 tm.ngx_tm_year, tm.ngx_tm_mon,
188 tm.ngx_tm_year, tm.ngx_tm_mon, 187 tm.ngx_tm_mday, tm.ngx_tm_hour,
189 tm.ngx_tm_mday, tm.ngx_tm_hour, 188 tm.ngx_tm_min, tm.ngx_tm_sec);
190 tm.ngx_tm_min, tm.ngx_tm_sec);
191 189
192 ngx_cached_err_log_time.data = p; 190 ngx_cached_err_log_time.data = p;
193 191
194 192
195 p = cached_http_log_time[slot]; 193 p = cached_http_log_time[slot];
196 194
197 ngx_snprintf((char *) p, sizeof("28/Sep/1970:12:00:00 +0600"), 195 ngx_sprintf(p, "%02d/%s/%d:%02d:%02d:%02d %c%02d%02d",
198 "%02d/%s/%d:%02d:%02d:%02d %c%02d%02d", 196 tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1],
199 tm.ngx_tm_mday, months[tm.ngx_tm_mon - 1], 197 tm.ngx_tm_year, tm.ngx_tm_hour,
200 tm.ngx_tm_year, tm.ngx_tm_hour, 198 tm.ngx_tm_min, tm.ngx_tm_sec,
201 tm.ngx_tm_min, tm.ngx_tm_sec, 199 ngx_gmtoff < 0 ? '-' : '+',
202 ngx_gmtoff < 0 ? '-' : '+', 200 abs(ngx_gmtoff / 60), abs(ngx_gmtoff % 60));
203 abs(ngx_gmtoff / 60), abs(ngx_gmtoff % 60));
204 201
205 ngx_cached_http_log_time.data = p; 202 ngx_cached_http_log_time.data = p;
206 203
207 204
208 #if (NGX_THREADS) 205 #if (NGX_THREADS)
211 208
212 } 209 }
213 210
214 211
215 u_char *ngx_http_time(u_char *buf, time_t t) 212 u_char *ngx_http_time(u_char *buf, time_t t)
216 #if 0
217 size_t ngx_http_time(u_char *buf, time_t t)
218 #endif
219 { 213 {
220 ngx_tm_t tm; 214 ngx_tm_t tm;
221 215
222 ngx_gmtime(t, &tm); 216 ngx_gmtime(t, &tm);
223 217
227 months[tm.ngx_tm_mon - 1], 221 months[tm.ngx_tm_mon - 1],
228 tm.ngx_tm_year, 222 tm.ngx_tm_year,
229 tm.ngx_tm_hour, 223 tm.ngx_tm_hour,
230 tm.ngx_tm_min, 224 tm.ngx_tm_min,
231 tm.ngx_tm_sec); 225 tm.ngx_tm_sec);
232
233 #if 0
234 return ngx_snprintf((char *) buf, sizeof("Mon, 28 Sep 1970 06:00:00 GMT"),
235 "%s, %02d %s %4d %02d:%02d:%02d GMT",
236 week[tm.ngx_tm_wday],
237 tm.ngx_tm_mday,
238 months[tm.ngx_tm_mon - 1],
239 tm.ngx_tm_year,
240 tm.ngx_tm_hour,
241 tm.ngx_tm_min,
242 tm.ngx_tm_sec);
243 #endif
244 } 226 }
245 227
246 228
247 u_char *ngx_http_cookie_time(u_char *buf, time_t t) 229 u_char *ngx_http_cookie_time(u_char *buf, time_t t)
248 #if 0
249 size_t ngx_http_cookie_time(u_char *buf, time_t t)
250 #endif
251 { 230 {
252 ngx_tm_t tm; 231 ngx_tm_t tm;
253 232
254 ngx_gmtime(t, &tm); 233 ngx_gmtime(t, &tm);
255 234
268 (tm.ngx_tm_year > 2037) ? tm.ngx_tm_year: 247 (tm.ngx_tm_year > 2037) ? tm.ngx_tm_year:
269 tm.ngx_tm_year % 100, 248 tm.ngx_tm_year % 100,
270 tm.ngx_tm_hour, 249 tm.ngx_tm_hour,
271 tm.ngx_tm_min, 250 tm.ngx_tm_min,
272 tm.ngx_tm_sec); 251 tm.ngx_tm_sec);
273
274 #if 0
275 if (tm.ngx_tm_year > 2037) {
276 return ngx_snprintf((char *) buf,
277 sizeof("Mon, 28-Sep-1970 06:00:00 GMT"),
278 "%s, %02d-%s-%d %02d:%02d:%02d GMT",
279 week[tm.ngx_tm_wday],
280 tm.ngx_tm_mday,
281 months[tm.ngx_tm_mon - 1],
282 tm.ngx_tm_year,
283 tm.ngx_tm_hour,
284 tm.ngx_tm_min,
285 tm.ngx_tm_sec);
286 } else {
287 return ngx_snprintf((char *) buf,
288 sizeof("Mon, 28-Sep-70 06:00:00 GMT"),
289 "%s, %02d-%s-%02d %02d:%02d:%02d GMT",
290 week[tm.ngx_tm_wday],
291 tm.ngx_tm_mday,
292 months[tm.ngx_tm_mon - 1],
293 tm.ngx_tm_year % 100,
294 tm.ngx_tm_hour,
295 tm.ngx_tm_min,
296 tm.ngx_tm_sec);
297 }
298 #endif
299 } 252 }
300 253
301 254
302 void ngx_gmtime(time_t t, ngx_tm_t *tp) 255 void ngx_gmtime(time_t t, ngx_tm_t *tp)
303 { 256 {