comparison src/core/ngx_times.c @ 50:72eb30262aac NGINX_0_1_25

nginx 0.1.25 *) Bugfix: nginx did run on Linux parisc. *) Feature: nginx now does not start under FreeBSD if the sysctl kern.ipc.somaxconn value is too big. *) Bugfix: if a request was internally redirected by the ngx_http_index_module module to the ngx_http_proxy_module or ngx_http_fastcgi_module modules, then the index file was not closed after request completion. *) Feature: the "proxy_pass" can be used in location with regular expression. *) Feature: the ngx_http_rewrite_filter_module module supports the condition like "if ($HTTP_USER_AGENT ~ MSIE)". *) Bugfix: nginx started too slow if the large number of addresses and text values were used in the "geo" directive. *) Change: a variable name must be declared as "$name" in the "geo" directive. The previous variant without "$" is still supported, but will be removed soon. *) Feature: the "%{VARIABLE}v" logging parameter. *) Feature: the "set $name value" directive. *) Bugfix: gcc 4.0 compatibility. *) Feature: the --with-openssl-opt=OPTIONS autoconfiguration directive.
author Igor Sysoev <http://sysoev.ru>
date Sat, 19 Mar 2005 00:00:00 +0300
parents 6cfc63e68377
children b55cbf18157e
comparison
equal deleted inserted replaced
49:93dabbc9efb9 50:72eb30262aac
68 68
69 static char *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; 69 static char *week[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
70 static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", 70 static char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
71 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; 71 "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
72 72
73 73 void
74 void ngx_time_init(void) 74 ngx_time_init(void)
75 { 75 {
76 struct timeval tv; 76 struct timeval tv;
77 77
78 ngx_memzero(&ngx_cached_gmtime, sizeof(ngx_tm_t)); 78 ngx_memzero(&ngx_cached_gmtime, sizeof(ngx_tm_t));
79 #ifdef ngx_tm_zone 79 #ifdef ngx_tm_zone
102 } 102 }
103 103
104 104
105 #if (NGX_THREADS) 105 #if (NGX_THREADS)
106 106
107 ngx_int_t ngx_time_mutex_init(ngx_log_t *log) 107 ngx_int_t
108 { 108 ngx_time_mutex_init(ngx_log_t *log)
109 if (!(ngx_time_mutex = ngx_mutex_init(log, NGX_MUTEX_LIGHT))) { 109 {
110 ngx_time_mutex = ngx_mutex_init(log, NGX_MUTEX_LIGHT);
111
112 if (ngx_time_mutex == NULL) {
110 return NGX_ERROR; 113 return NGX_ERROR;
111 } 114 }
112 115
113 return NGX_OK; 116 return NGX_OK;
114 } 117 }
115 118
116 #endif 119 #endif
117 120
118 121
119 void ngx_time_update(time_t s) 122 void
123 ngx_time_update(time_t s)
120 { 124 {
121 u_char *p; 125 u_char *p;
122 ngx_tm_t tm; 126 ngx_tm_t tm;
123 127
124 if (ngx_time() == s) { 128 if (ngx_time() == s) {
207 #endif 211 #endif
208 212
209 } 213 }
210 214
211 215
212 u_char *ngx_http_time(u_char *buf, time_t t) 216 u_char *
217 ngx_http_time(u_char *buf, time_t t)
213 { 218 {
214 ngx_tm_t tm; 219 ngx_tm_t tm;
215 220
216 ngx_gmtime(t, &tm); 221 ngx_gmtime(t, &tm);
217 222
224 tm.ngx_tm_min, 229 tm.ngx_tm_min,
225 tm.ngx_tm_sec); 230 tm.ngx_tm_sec);
226 } 231 }
227 232
228 233
229 u_char *ngx_http_cookie_time(u_char *buf, time_t t) 234 u_char *
235 ngx_http_cookie_time(u_char *buf, time_t t)
230 { 236 {
231 ngx_tm_t tm; 237 ngx_tm_t tm;
232 238
233 ngx_gmtime(t, &tm); 239 ngx_gmtime(t, &tm);
234 240
250 tm.ngx_tm_min, 256 tm.ngx_tm_min,
251 tm.ngx_tm_sec); 257 tm.ngx_tm_sec);
252 } 258 }
253 259
254 260
255 void ngx_gmtime(time_t t, ngx_tm_t *tp) 261 void
262 ngx_gmtime(time_t t, ngx_tm_t *tp)
256 { 263 {
257 ngx_int_t sec, min, hour, mday, mon, year, wday, yday, days; 264 ngx_int_t sec, min, hour, mday, mon, year, wday, yday, days;
258 265
259 days = t / 86400; 266 days = t / 86400;
260 267