Return-Path: Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 53911 invoked by uid 500); 28 May 2002 21:47:32 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 53899 invoked by uid 500); 28 May 2002 21:47:32 -0000 Delivered-To: apmail-httpd-2.0-cvs@apache.org Date: 28 May 2002 21:47:31 -0000 Message-ID: <20020528214731.77219.qmail@icarus.apache.org> From: jwoolley@apache.org To: httpd-2.0-cvs@apache.org Subject: cvs commit: httpd-2.0/modules/ssl ssl_engine_vars.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jwoolley 02/05/28 14:47:31 Modified: modules/ssl ssl_engine_vars.c Log: APR-ize the localtime() fooness, since localtime() is not always threadsafe. PR: 9469 Revision Changes Path 1.20 +9 -13 httpd-2.0/modules/ssl/ssl_engine_vars.c Index: ssl_engine_vars.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/ssl/ssl_engine_vars.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -u -r1.19 -r1.20 --- ssl_engine_vars.c 18 Apr 2002 08:45:34 -0000 1.19 +++ ssl_engine_vars.c 28 May 2002 21:47:31 -0000 1.20 @@ -93,8 +93,7 @@ SSLModConfigRec *mc = myModConfig(s); char *result; BOOL resdup; - time_t tc; - struct tm *tm; + apr_time_exp_t tm; result = NULL; resdup = TRUE; @@ -200,16 +199,14 @@ resdup = FALSE; } else if (strcEQ(var, "TIME_YEAR")) { - tc = time(NULL); - tm = localtime(&tc); + apr_time_exp_lt(&tm, apr_time_now()); result = apr_psprintf(p, "%02d%02d", - (tm->tm_year / 100) + 19, tm->tm_year % 100); + (tm.tm_year / 100) + 19, tm.tm_year % 100); resdup = FALSE; } #define MKTIMESTR(format, tmfield) \ - tc = time(NULL); \ - tm = localtime(&tc); \ - result = apr_psprintf(p, format, tm->tmfield); \ + apr_time_exp_lt(&tm, apr_time_now()); \ + result = apr_psprintf(p, format, tm.tmfield); \ resdup = FALSE; else if (strcEQ(var, "TIME_MON")) { MKTIMESTR("%02d", tm_mon+1) @@ -230,12 +227,11 @@ MKTIMESTR("%d", tm_wday) } else if (strcEQ(var, "TIME")) { - tc = time(NULL); - tm = localtime(&tc); + apr_time_exp_lt(&tm, apr_time_now()); result = apr_psprintf(p, - "%02d%02d%02d%02d%02d%02d%02d", (tm->tm_year / 100) + 19, - (tm->tm_year % 100), tm->tm_mon+1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + "%02d%02d%02d%02d%02d%02d%02d", (tm.tm_year / 100) + 19, + (tm.tm_year % 100), tm.tm_mon+1, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); resdup = FALSE; } /* all other env-variables from the parent Apache process */