You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@hyperreal.org on 2000/01/07 21:38:15 UTC

cvs commit: apache-2.0/src/modules/standard mod_autoindex.c mod_rewrite.c mod_usertrack.c

rbb         00/01/07 12:38:15

  Modified:    src/modules/standard mod_autoindex.c mod_rewrite.c
                        mod_usertrack.c
  Log:
  Move some modules over to using ap_time_t instead of struct tm.
  
  Revision  Changes    Path
  1.18      +6 -3      apache-2.0/src/modules/standard/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_autoindex.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_autoindex.c	2000/01/06 19:19:34	1.17
  +++ mod_autoindex.c	2000/01/07 20:38:05	1.18
  @@ -1273,7 +1273,7 @@
   			       autoindex_config_rec *d, request_rec *r,
   			       int autoindex_opts, char keyid, char direction)
   {
  -    int x;
  +    int x, rv;
       char *name = r->uri;
       char *tp;
       int static_columns = (autoindex_opts & SUPPRESS_COLSORT);
  @@ -1404,8 +1404,11 @@
   	    if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
   		if (ar[x]->lm != -1) {
   		    char time_str[MAX_STRING_LEN];
  -		    struct tm *ts = localtime(&ar[x]->lm);
  -		    strftime(time_str, MAX_STRING_LEN, "%d-%b-%Y %H:%M  ", ts);
  +		    ap_time_t *ts = NULL;
  +                    ap_make_time(&ts, r->pool);
  +                    ap_set_ansitime(ts, ar[x]->lm);
  +		    ap_strftime(time_str, &rv, MAX_STRING_LEN, 
  +                                "%d-%b-%Y %H:%M  ", ts);
   		    ap_rputs(time_str, r);
   		}
   		else {
  
  
  
  1.10      +32 -19    apache-2.0/src/modules/standard/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_rewrite.c	2000/01/07 15:50:40	1.9
  +++ mod_rewrite.c	2000/01/07 20:38:06	1.10
  @@ -3556,8 +3556,14 @@
   {
       const char *result;
       char resultbuf[LONG_STRING_LEN];
  -    time_t tc;
  -    struct tm *tm;
  +    ap_time_t *tm = NULL;
  +    ap_int32_t tmvalue = 0;
  +    ap_int32_t year;
  +    ap_int32_t mon;
  +    ap_int32_t mday;
  +    ap_int32_t hour;
  +    ap_int32_t min;
  +    ap_int32_t sec;
       request_rec *rsub;
   #ifndef WIN32
       struct passwd *pw;
  @@ -3667,42 +3673,49 @@
   
       /* underlaying Unix system stuff */
       else if (strcasecmp(var, "TIME_YEAR") == 0) {
  -        tc = time(NULL);
  -        tm = localtime(&tc);
  +        ap_make_init_time(&tm, r->pool);
  +        ap_explode_time(tm, APR_LOCALTIME);
  +        ap_get_year(tm, &year);
           ap_snprintf(resultbuf, sizeof(resultbuf), "%02d%02d",
  -                    (tm->tm_year / 100) + 19, tm->tm_year % 100);
  +                    (year / 100) + 19, year % 100);
           result = resultbuf;
       }
   #define MKTIMESTR(format, tmfield) \
  -    tc = time(NULL); \
  -    tm = localtime(&tc); \
  -    ap_snprintf(resultbuf, sizeof(resultbuf), format, tm->tmfield); \
  +    ap_make_init_time(&tm, r->pool); \
  +    ap_explode_time(tm, APR_LOCALTIME); \
  +    ap_get_tmfield(tm, &tmvalue); \
  +    ap_snprintf(resultbuf, sizeof(resultbuf), format, tmvalue); \
       result = resultbuf;
       else if (strcasecmp(var, "TIME_MON") == 0) {
  -        MKTIMESTR("%02d", tm_mon+1)
  +        MKTIMESTR("%02d", mon+1)
       }
       else if (strcasecmp(var, "TIME_DAY") == 0) {
  -        MKTIMESTR("%02d", tm_mday)
  +        MKTIMESTR("%02d", mday)
       }
       else if (strcasecmp(var, "TIME_HOUR") == 0) {
  -        MKTIMESTR("%02d", tm_hour)
  +        MKTIMESTR("%02d", hour)
       }
       else if (strcasecmp(var, "TIME_MIN") == 0) {
  -        MKTIMESTR("%02d", tm_min)
  +        MKTIMESTR("%02d", min)
       }
       else if (strcasecmp(var, "TIME_SEC") == 0) {
  -        MKTIMESTR("%02d", tm_sec)
  +        MKTIMESTR("%02d", sec)
       }
       else if (strcasecmp(var, "TIME_WDAY") == 0) {
  -        MKTIMESTR("%d", tm_wday)
  +        MKTIMESTR("%d", wday)
       }
       else if (strcasecmp(var, "TIME") == 0) {
  -        tc = time(NULL);
  -        tm = localtime(&tc);
  +        ap_make_init_time(&tm, r->pool);
  +        ap_explode_time(tm, APR_LOCALTIME);
  +        ap_get_year(tm, &year);
  +        ap_get_mon(tm, &mon);
  +        ap_get_mday(tm, &mday);
  +        ap_get_hour(tm, &hour);
  +        ap_get_min(tm, &min);
  +        ap_get_sec(tm, &sec);
           ap_snprintf(resultbuf, sizeof(resultbuf),
  -                    "%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", (year / 100) + 19,
  +                    (year % 100), mon+1, mday, hour, min, sec);
           result = resultbuf;
           rewritelog(r, 1, "RESULT='%s'", result);
       }
  
  
  
  1.9       +0 -1      apache-2.0/src/modules/standard/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_usertrack.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- mod_usertrack.c	2000/01/06 19:19:39	1.8
  +++ mod_usertrack.c	2000/01/07 20:38:06	1.9
  @@ -181,7 +181,6 @@
   #endif
   
       if (cls->expires) {
  -        struct tm *tms;
           ap_time_t *when = NULL;
           ap_int64_t req_time;
           char *temp_cookie = NULL;