comparison src/core/ngx_times.c @ 394:05981f639d21 NGINX_0_7_9

nginx 0.7.9 *) Change: now ngx_http_charset_module works by default with following MIME types: text/html, text/css, text/xml, text/plain, text/vnd.wap.wml, application/x-javascript, and application/rss+xml. *) Feature: the "charset_types" and "addition_types" directives. *) Feature: now the "gzip_types", "ssi_types", and "sub_filter_types" directives use hash. *) Feature: the ngx_cpp_test_module. *) Feature: the "expires" directive supports daily time. *) Feature: the ngx_http_xslt_module improvements and bug fixing. Thanks to Denis F. Latypoff and Maxim Dounin. *) Bugfix: the "log_not_found" directive did not work for index files tests. *) Bugfix: HTTPS connections might hang, if kqueue, epoll, rtsig, or eventport methods were used; the bug had appeared in 0.7.7. *) Bugfix: if the "server_name", "valid_referers", and "map" directives used an "*.domain.tld" wildcard and exact name "domain.tld" was not set, then the exact name was matched by the wildcard; the bugs had appeared in 0.3.18.
author Igor Sysoev <http://sysoev.ru>
date Tue, 12 Aug 2008 00:00:00 +0400
parents 6639b93e81b2
children a094317ba307
comparison
equal deleted inserted replaced
393:040b8c84d040 394:05981f639d21
289 tp->ngx_tm_mday = (ngx_tm_mday_t) mday; 289 tp->ngx_tm_mday = (ngx_tm_mday_t) mday;
290 tp->ngx_tm_mon = (ngx_tm_mon_t) mon; 290 tp->ngx_tm_mon = (ngx_tm_mon_t) mon;
291 tp->ngx_tm_year = (ngx_tm_year_t) year; 291 tp->ngx_tm_year = (ngx_tm_year_t) year;
292 tp->ngx_tm_wday = (ngx_tm_wday_t) wday; 292 tp->ngx_tm_wday = (ngx_tm_wday_t) wday;
293 } 293 }
294
295
296 time_t
297 ngx_next_time(time_t when)
298 {
299 time_t now, next;
300 struct tm tm;
301
302 now = ngx_time();
303
304 ngx_libc_localtime(now, &tm);
305
306 tm.tm_hour = (int) (when / 3600);
307 when %= 3600;
308 tm.tm_min = (int) (when / 60);
309 tm.tm_sec = (int) (when % 60);
310
311 next = mktime(&tm);
312
313 if (next == -1) {
314 return -1;
315 }
316
317 if (next - now > 0) {
318 return next;
319 }
320
321 tm.tm_mday++;
322
323 /* mktime() should normalize a date (Jan 32, etc) */
324
325 next = mktime(&tm);
326
327 if (next != -1) {
328 return next;
329 }
330
331 return -1;
332 }