You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2002/06/30 06:30:41 UTC

cvs commit: httpd-2.0/modules/metadata mod_expires.c mod_mime_magic.c mod_unique_id.c mod_usertrack.c

brianp      2002/06/29 21:30:41

  Modified:    modules/metadata mod_expires.c mod_mime_magic.c
                        mod_unique_id.c mod_usertrack.c
  Log:
  Replaced APR_USEC_PER_SEC division with the new apr_time_sec() macro
  
  Revision  Changes    Path
  1.38      +6 -4      httpd-2.0/modules/metadata/mod_expires.c
  
  Index: mod_expires.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_expires.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_expires.c	17 May 2002 11:33:10 -0000	1.37
  +++ mod_expires.c	30 Jun 2002 04:30:41 -0000	1.38
  @@ -423,6 +423,7 @@
       apr_time_t base;
       apr_time_t additional;
       apr_time_t expires;
  +    int additional_sec;
       char *timestr;
   
       if (ap_is_HTTP_ERROR(r->status))       /* Don't add Expires headers to errors */
  @@ -477,14 +478,16 @@
   	    return DECLINED;
   	}
   	base = r->finfo.mtime;
  -        additional = atoi(&code[1]) * APR_USEC_PER_SEC;
  +        additional_sec = atoi(&code[1]);
  +        additional = apr_time_from_sec(additional_sec);
           break;
       case 'A':
           /* there's been some discussion and it's possible that 
            * 'access time' will be stored in request structure
            */
           base = r->request_time;
  -        additional = atoi(&code[1]) * APR_USEC_PER_SEC;
  +        additional_sec = atoi(&code[1]);
  +        additional = apr_time_from_sec(additional_sec);
           break;
       default:
           /* expecting the add_* routines to be case-hardened this 
  @@ -498,8 +501,7 @@
       expires = base + additional;
       apr_table_mergen(r->headers_out, "Cache-Control",
   		    apr_psprintf(r->pool, "max-age=%qd",
  -				(expires - r->request_time)
  -				    / APR_USEC_PER_SEC));
  +                                 apr_time_sec(expires - r->request_time)));
       timestr = apr_palloc(r->pool, APR_RFC822_DATE_LEN);
       apr_rfc822_date(timestr, expires);
       apr_table_setn(r->headers_out, "Expires", timestr);
  
  
  
  1.59      +1 -1      httpd-2.0/modules/metadata/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_mime_magic.c,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- mod_mime_magic.c	23 Jun 2002 06:13:17 -0000	1.58
  +++ mod_mime_magic.c	30 Jun 2002 04:30:41 -0000	1.59
  @@ -1760,7 +1760,7 @@
       case DATE:
       case BEDATE:
       case LEDATE:
  -        apr_ctime(time_str, APR_USEC_PER_SEC * (apr_time_t)*(time_t *)&p->l);
  +        apr_ctime(time_str, apr_time_from_sec(*(time_t *)&p->l));
           pp = time_str;
   	(void) magic_rsl_printf(r, m->desc, pp);
   	return;
  
  
  
  1.40      +4 -2      httpd-2.0/modules/metadata/mod_unique_id.c
  
  Index: mod_unique_id.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_unique_id.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- mod_unique_id.c	18 May 2002 04:13:13 -0000	1.39
  +++ mod_unique_id.c	30 Jun 2002 04:30:41 -0000	1.40
  @@ -179,6 +179,7 @@
       apr_status_t rv;
       char *ipaddrstr;
       apr_sockaddr_t *sockaddr;
  +    apr_time_t now;
   
       /*
        * Calculate the sizes and offsets in cur_unique_id.
  @@ -251,7 +252,8 @@
        * But protecting against it is relatively cheap.  We just sleep into the
        * next second.
        */
  -    pause = (apr_short_interval_time_t)(1000000 - (apr_time_now() % APR_USEC_PER_SEC));
  +    now = apr_time_now();
  +    pause = (apr_short_interval_time_t)(1000000 - apr_time_usec(now));
       apr_sleep(pause);
       return OK;
   }
  @@ -295,7 +297,7 @@
       /* Some systems have very low variance on the low end of their system
        * counter, defend against that.
        */
  -    cur_unique_id.counter = (unsigned short)(tv % APR_USEC_PER_SEC / 10);
  +    cur_unique_id.counter = (unsigned short)(apr_time_usec(tv) / 10);
   
       /*
        * We must always use network ordering for these bytes, so that
  
  
  
  1.38      +1 -1      httpd-2.0/modules/metadata/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_usertrack.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_usertrack.c	21 Mar 2002 10:10:40 -0000	1.37
  +++ mod_usertrack.c	30 Jun 2002 04:30:41 -0000	1.38
  @@ -157,7 +157,7 @@
           if ((dcfg->style == CT_UNSET) || (dcfg->style == CT_NETSCAPE)) {
   	    apr_time_exp_t tms;
               apr_time_exp_gmt(&tms, r->request_time 
  -                                 + cls->expires * APR_USEC_PER_SEC);
  +                                 + apr_time_from_sec(cls->expires));
               new_cookie = apr_psprintf(r->pool,
                                          "%s; expires=%s, "
                                          "%.2d-%s-%.2d %.2d:%.2d:%.2d GMT",