httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgau...@hyperreal.org
Subject cvs commit: apache-2.0/src/modules/standard mod_autoindex.c mod_cgi.c mod_cgid.c mod_expires.c mod_include.c mod_log_config.c mod_rewrite.c mod_status.c mod_usertrack.c
Date Sun, 09 Jan 2000 05:18:35 GMT
dgaudet     00/01/08 21:18:34

  Modified:    src      modules.c
               src/include http_protocol.h http_request.h httpd.h
                        util_date.h
               src/lib/apr/file_io/unix filestat.c
               src/lib/apr/include apr_file_io.h apr_time.h
               src/lib/apr/test ab_apr.c testtime.c
               src/lib/apr/time/unix Makefile.in time.c timestr.c
               src/main http_core.c http_log.c http_protocol.c
                        http_request.c util.c util_date.c util_script.c
               src/modules/experimental Makefile.tmpl
               src/modules/standard mod_autoindex.c mod_cgi.c mod_cgid.c
                        mod_expires.c mod_include.c mod_log_config.c
                        mod_rewrite.c mod_status.c mod_usertrack.c
  Removed:     src/lib/apr/time/unix access.c
  Log:
  time overhaul:
  
  - ap_time_t is a 64-bit scalar, microseconds since epoch
  - ap_exploded_time_t corresponds to struct tm with a few extras
  
  probably broken on anything except linux.
  
  Revision  Changes    Path
  1.4       +12 -3     apache-2.0/src/Attic/modules.c
  
  Index: modules.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/Attic/modules.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- modules.c	1999/12/05 19:33:27	1.3
  +++ modules.c	2000/01/09 05:18:15	1.4
  @@ -7,7 +7,6 @@
   #include "http_config.h"
   
   extern module core_module;
  -extern module mpm_mpmt_pthread_module;
   extern module env_module;
   extern module config_log_module;
   extern module mime_module;
  @@ -21,10 +20,14 @@
   extern module action_module;
   extern module userdir_module;
   extern module alias_module;
  +extern module rewrite_module;
   extern module access_module;
   extern module auth_module;
  +extern module expires_module;
  +extern module usertrack_module;
   extern module setenvif_module;
   extern module echo_module;
  +extern module mpm_mpmt_pthread_module;
   
   /*
    *  Modules which implicitly form the
  @@ -35,7 +38,6 @@
    */
   module *ap_prelinked_modules[] = {
     &core_module,
  -  &mpm_mpmt_pthread_module,
     &env_module,
     &config_log_module,
     &mime_module,
  @@ -49,10 +51,14 @@
     &action_module,
     &userdir_module,
     &alias_module,
  +  &rewrite_module,
     &access_module,
     &auth_module,
  +  &expires_module,
  +  &usertrack_module,
     &setenvif_module,
     &echo_module,
  +  &mpm_mpmt_pthread_module,
     NULL
   };
   
  @@ -65,7 +71,6 @@
    */
   module *ap_preloaded_modules[] = {
     &core_module,
  -  &mpm_mpmt_pthread_module,
     &env_module,
     &config_log_module,
     &mime_module,
  @@ -79,10 +84,14 @@
     &action_module,
     &userdir_module,
     &alias_module,
  +  &rewrite_module,
     &access_module,
     &auth_module,
  +  &expires_module,
  +  &usertrack_module,
     &setenvif_module,
     &echo_module,
  +  &mpm_mpmt_pthread_module,
     NULL
   };
   
  
  
  
  1.10      +1 -1      apache-2.0/src/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/http_protocol.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- http_protocol.h	1999/12/20 16:38:31	1.9
  +++ http_protocol.h	2000/01/09 05:18:16	1.10
  @@ -118,7 +118,7 @@
   
   API_EXPORT(int) ap_set_content_length(request_rec *r, long length);
   API_EXPORT(int) ap_set_keepalive(request_rec *r);
  -API_EXPORT(ap_time_t *) ap_rationalize_mtime(request_rec *r, ap_time_t *mtime);
  +API_EXPORT(ap_time_t) ap_rationalize_mtime(request_rec *r, ap_time_t mtime);
   API_EXPORT(char *) ap_make_etag(request_rec *r, int force_weak);
   API_EXPORT(void) ap_set_etag(request_rec *r);
   API_EXPORT(void) ap_set_last_modified(request_rec *r);
  
  
  
  1.5       +1 -1      apache-2.0/src/include/http_request.h
  
  Index: http_request.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/http_request.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- http_request.h	1999/12/20 16:38:31	1.4
  +++ http_request.h	2000/01/09 05:18:16	1.5
  @@ -104,7 +104,7 @@
   API_EXPORT(void) ap_internal_redirect_handler(const char *new_uri, request_rec *);
   API_EXPORT(int) ap_some_auth_required(request_rec *r);
   API_EXPORT(int) ap_is_initial_req(request_rec *r);
  -API_EXPORT(ap_time_t *) ap_update_mtime(request_rec *r, ap_time_t *dependency_mtime);
  +API_EXPORT(void) ap_update_mtime(request_rec *r, ap_time_t dependency_mtime);
   
   #ifdef CORE_PRIVATE
   /* Function called by main.c to handle first-level request */
  
  
  
  1.18      +4 -4      apache-2.0/src/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- httpd.h	2000/01/06 14:43:00	1.17
  +++ httpd.h	2000/01/09 05:18:16	1.18
  @@ -668,7 +668,7 @@
       int proto_num;		/* Number version of protocol; 1.1 = 1001 */
       const char *hostname;	/* Host, as set by full URI or Host: */
   
  -    ap_time_t *request_time;	/* When the request started */
  +    ap_time_t request_time;	/* When the request started */
   
       const char *status_line;	/* Status line, if set by script */
       int status;			/* In any case */
  @@ -704,7 +704,7 @@
   
       int sent_bodyct;		/* byte count in stream is for body */
       long bytes_sent;		/* body byte count, for easy access */
  -    ap_time_t *mtime;		/* Time the resource was last modified */
  +    ap_time_t mtime;		/* Time the resource was last modified */
   
       /* HTTP/1.1 connection-level features */
   
  @@ -914,9 +914,9 @@
    */
   
   /* Time */
  -API_EXPORT(char *) ap_get_time(void);
  +
   API_EXPORT(char *) ap_field_noparam(ap_context_t *p, const char *intype);
  -API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, int gmt);
  +API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t t, const char *fmt, int gmt);
   
   /* String handling. The *_nc variants allow you to use non-const char **s as
      arguments (unfortunately C won't automatically convert a char ** to a const
  
  
  
  1.6       +1 -1      apache-2.0/src/include/util_date.h
  
  Index: util_date.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/include/util_date.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- util_date.h	1999/12/21 21:41:43	1.5
  +++ util_date.h	2000/01/09 05:18:17	1.6
  @@ -76,7 +76,7 @@
   #define BAD_DATE (time_t)0
   
   API_EXPORT(int) ap_checkmask(const char *data, const char *mask);
  -API_EXPORT(ap_time_t *) ap_parseHTTPdate(const char *date, ap_context_t *cont);
  +API_EXPORT(ap_time_t) ap_parseHTTPdate(const char *date);
   
   #ifdef __cplusplus
   }
  
  
  
  1.9       +7 -13     apache-2.0/src/lib/apr/file_io/unix/filestat.c
  
  Index: filestat.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filestat.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- filestat.c	2000/01/06 19:19:25	1.8
  +++ filestat.c	2000/01/09 05:18:18	1.9
  @@ -66,6 +66,7 @@
   ap_status_t ap_getfileinfo(ap_finfo_t *finfo, struct file_t *thefile)
   {
       struct stat info;
  +/* XXX: this should be the equivalent of fstat() in unix, using stat() here is wrong */
       int rv = stat(thefile->fname, &info);
   
       if (rv == 0) {
  @@ -74,13 +75,9 @@
           finfo->group = info.st_gid;
           finfo->size = info.st_size;
           finfo->inode = info.st_ino;
  -        ap_make_time(&finfo->atime, thefile->cntxt);
  -        ap_set_ansitime(finfo->atime, info.st_atime);
  -        ap_make_time(&finfo->mtime, thefile->cntxt);
  -        ap_set_ansitime(finfo->mtime, info.st_mtime);
  -        ap_make_time(&finfo->ctime, thefile->cntxt);
  -        ap_set_ansitime(finfo->ctime, info.st_ctime);
  -
  +	ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  +	ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  +	ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
           return APR_SUCCESS;
       }
       else {
  @@ -107,12 +104,9 @@
           finfo->group = info.st_gid;
           finfo->size = info.st_size;
           finfo->inode = info.st_ino;
  -        ap_make_time(&finfo->atime, cont);
  -        ap_set_ansitime(finfo->atime, info.st_atime);
  -        ap_make_time(&finfo->mtime, cont);
  -        ap_set_ansitime(finfo->mtime, info.st_mtime);
  -        ap_make_time(&finfo->ctime, cont);
  -        ap_set_ansitime(finfo->ctime, info.st_ctime);
  +	ap_ansi_time_to_ap_time(&finfo->atime, info.st_atime);
  +	ap_ansi_time_to_ap_time(&finfo->mtime, info.st_mtime);
  +	ap_ansi_time_to_ap_time(&finfo->ctime, info.st_ctime);
           return APR_SUCCESS;
       }
       else {
  
  
  
  1.27      +3 -3      apache-2.0/src/lib/apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- apr_file_io.h	2000/01/06 14:43:19	1.26
  +++ apr_file_io.h	2000/01/09 05:18:18	1.27
  @@ -120,9 +120,9 @@
       ap_gid_t group;
       ap_ino_t inode;
       ap_off_t size;
  -    ap_time_t *atime;
  -    ap_time_t *mtime;
  -    ap_time_t *ctime;
  +    ap_time_t atime;
  +    ap_time_t mtime;
  +    ap_time_t ctime;
   };
   
   /*   Function definitions */
  
  
  
  1.11      +49 -46    apache-2.0/src/lib/apr/include/apr_time.h
  
  Index: apr_time.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- apr_time.h	2000/01/06 20:20:21	1.10
  +++ apr_time.h	2000/01/09 05:18:19	1.11
  @@ -63,55 +63,58 @@
   extern "C" {
   #endif /* __cplusplus */
   
  -typedef enum {APR_LOCALTIME, APR_UTCTIME} ap_timetype_e;
  -
  -/* ap_ansi_time_t is defined as the number of seconds since
  - * 0:00:00 01/01/70.
  - */
  -typedef ap_int64_t           ap_ansi_time_t;
  -typedef struct atime_t       ap_time_t;
  -
   API_VAR_IMPORT const char ap_month_snames[12][4];
   API_VAR_IMPORT const char ap_day_snames[7][4];
  +
  +/* number of microseconds since 00:00:00 january 1, 1970 UTC */
  +typedef ap_int64_t ap_time_t;
  +
  +#define AP_USEC_PER_SEC (1000000LL)
  +
  +/* the time right now */
  +ap_time_t ap_now(void);
  +
  +/* a structure similar to ANSI struct tm with the following differences:
  +   - tm_usec isn't an ANSI field
  +   - tm_gmtoff isn't an ANSI field (it's a bsdism)
  +*/
  +typedef struct {
  +    ap_int32_t tm_usec;	/* microseconds past tm_sec */
  +    ap_int32_t tm_sec;	/* (0-61) seconds past tm_min */
  +    ap_int32_t tm_min;  /* (0-59) minutes past tm_hour */
  +    ap_int32_t tm_hour; /* (0-23) hours past midnight */
  +    ap_int32_t tm_mday; /* (1-31) day of the month */
  +    ap_int32_t tm_mon;  /* (0-11) month of the year */
  +    ap_int32_t tm_year; /* year since 1900 */
  +    ap_int32_t tm_wday; /* (0-6) days since sunday */
  +    ap_int32_t tm_yday; /* (0-365) days since jan 1 */
  +    ap_int32_t tm_isdst; /* daylight saving time */
  +    ap_int32_t tm_gmtoff; /* seconds east of UTC */
  +} ap_exploded_time_t;
  +
  +/* convert an ANSI time_t to ap_time_t */
  +ap_status_t ap_ansi_time_to_ap_time(ap_time_t *result, time_t input);
  +
  +ap_status_t ap_explode_gmt(ap_exploded_time_t *result, ap_time_t input);
  +ap_status_t ap_explode_localtime(ap_exploded_time_t *result, ap_time_t input);
  +ap_status_t ap_implode_time(ap_time_t *result, ap_exploded_time_t *input);
  +
  +/* ap_rfc822_date formats dates in the RFC822
  +   format in an efficient manner.  it is a fixed length
  +   format and requires the indicated amount of storage
  +   including trailing \0 */
  +#define AP_RFC822_DATE_LEN (30)
  +ap_status_t ap_rfc822_date(char *date_str, ap_time_t t);
  +
  +/* ap_ctime formats dates in the ctime() format
  +   in an efficient manner.  it is a fixed length format
  +   and requires the indicated amount of storage
  +   including trailing \0 */
  +#define AP_CTIME_LEN (25)
  +ap_status_t ap_ctime(char *date_str, ap_time_t t);
  +
  +ap_status_t ap_strftime(char *s, ap_size_t *retsize, ap_size_t max, const char *format, ap_exploded_time_t *tm);
   
  -/* Function Definitions */
  -ap_status_t ap_make_time(ap_time_t **, ap_context_t *);
  -ap_status_t ap_make_init_time(ap_time_t **, ap_context_t *);
  -ap_status_t ap_current_time(ap_time_t *);
  -ap_status_t ap_explode_time(ap_time_t *, ap_timetype_e);
  -ap_status_t ap_implode_time(ap_time_t *);
  -
  -ap_status_t ap_timestr(char **date_str, struct atime_t *t, ap_timetype_e type, ap_context_t *p);
  -ap_status_t ap_strftime(char *s, ap_size_t *retsize, ap_size_t max, const char *format, ap_time_t *tm);
  -
  -/* accessor functions */
  -ap_status_t ap_get_ansitime(ap_time_t *, ap_ansi_time_t *);
  -ap_status_t ap_timediff(ap_time_t *, ap_time_t *, ap_int32_t *);
  -
  -ap_status_t ap_get_sec(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_min(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_hour(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_mday(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_mon(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_year(ap_time_t *, ap_int32_t *);
  -ap_status_t ap_get_wday(ap_time_t *, ap_int32_t *);
  -
  -ap_status_t ap_set_ansitime(ap_time_t *, ap_ansi_time_t);
  -ap_status_t ap_set_sec(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_min(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_hour(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_mday(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_mon(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_year(ap_time_t *, ap_int32_t);
  -ap_status_t ap_set_wday(ap_time_t *, ap_int32_t);
  -ap_status_t ap_timecmp(ap_time_t *a, ap_time_t *b);
  -
  -ap_status_t ap_get_gmtoff(int *tz, ap_time_t *tt, ap_context_t *cont);
  -
  -ap_status_t ap_get_timedata(ap_time_t *, char *, void *);
  -ap_status_t ap_set_timedata(ap_time_t *, void *, char *,
  -                            ap_status_t (*cleanup) (void *));
  - 
   #ifdef __cplusplus
   }
   #endif
  
  
  
  1.15      +19 -28    apache-2.0/src/lib/apr/test/ab_apr.c
  
  Index: ab_apr.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/ab_apr.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- ab_apr.c	2000/01/06 14:43:21	1.14
  +++ ab_apr.c	2000/01/09 05:18:19	1.15
  @@ -132,7 +132,7 @@
       int cbx;			/* offset in cbuffer */
       int keepalive;		/* non-zero if a keep-alive request */
       int gotheader;		/* non-zero if we have the entire header in cbuff */
  -    ap_time_t *start, *connect, *done;
  +    ap_time_t start, connect, done;
       int socknum;
   };
   
  @@ -182,7 +182,7 @@
   int err_length = 0, err_conn = 0, err_except = 0;
   int err_response = 0;
   
  -ap_time_t *start, *endtime;
  +ap_time_t start, endtime;
   
   /* global request (and its length) */
   char request[512];
  @@ -220,7 +220,7 @@
   static void write_request(struct connection *c)
   {
       ap_ssize_t len = reqlen;
  -    ap_current_time(c->connect);
  +    c->connect = ap_now();
       ap_setsocketopt(c->aprsock, APR_SO_TIMEOUT, 30);
       if (ap_send(c->aprsock, request, &reqlen) != APR_SUCCESS &&
           reqlen != len) {
  @@ -244,8 +244,8 @@
   {
       int timetaken;
   
  -    ap_current_time(endtime);
  -    ap_timediff(endtime, start, &timetaken);
  +    endtime = ap_now();
  +    timetaken = (endtime - start) / AP_USEC_PER_SEC;
   
       printf("\r                                                                           \r");
       printf("Server Software:        %s\n", servername);
  @@ -319,8 +319,8 @@
   {
       int timetaken;
   
  -    ap_current_time(endtime);
  -    ap_timediff(endtime, start, &timetaken);
  +    endtime = ap_now();
  +    timetaken = (endtime - start) / AP_USEC_PER_SEC;
   
       printf("\n\n<table %s>\n", tablestring);
       printf("<tr %s><th colspan=2 %s>Server Software:</th>"
  @@ -451,7 +451,7 @@
       if (ap_set_remote_port(c->aprsock, port) != APR_SUCCESS) {
           err("Port:");
       }
  -    ap_current_time(c->start);
  +    c->start = ap_now();
       if (ap_connect(c->aprsock, hostname) != APR_SUCCESS) {
           if (errno == APR_EINPROGRESS) {
               c->state = STATE_CONNECTING;
  @@ -494,10 +494,10 @@
           /* save out time */
           if (done < requests) {
               struct data s;
  -            ap_current_time(c->done);
  +	    c->done = ap_now();
               s.read = c->read;
  -            ap_timediff(c->connect, c->start, &s.ctime);
  -            ap_timediff(c->done, c->start, &s.time);
  +	    s.ctime = (c->connect - c->start) / 1000;
  +	    s.time = (c->done - c->start) / 1000;
               stats[done++] = s;
           }
       }
  @@ -647,10 +647,10 @@
           }
           if (done < requests) {
               struct data s;
  -            ap_current_time(c->done);
  +	    c->done = ap_now();
               s.read = c->read;
  -            ap_timediff(c->connect, c->start, &s.ctime);
  -            ap_timediff(c->done, c->start, &s.time);
  +	    s.ctime = (c->connect - c->start) / 1000;
  +	    s.time = (c->done - c->start) / 1000;
               stats[done++] = s;
           }
           c->keepalive = 0;
  @@ -669,7 +669,7 @@
   
   static void test(void)
   {
  -    ap_time_t *now;
  +    ap_time_t now;
       time_t timeout;
       ap_int16_t rv;
       int i;
  @@ -679,7 +679,7 @@
           fflush(stdout);
       }
   
  -    ap_make_time(&now, cntxt);
  +    now = ap_now();
   
       con = (struct connection *)malloc(concurrency * sizeof(struct connection));
       memset(con, 0, concurrency * sizeof(struct connection));
  @@ -687,12 +687,6 @@
       stats = (struct data *)malloc(requests * sizeof(struct data));
       ap_setup_poll(&readbits, concurrency, cntxt);
   
  -    for (i = 0; i < concurrency; i++) {
  -        ap_make_time(&con[i].start, cntxt);
  -        ap_make_time(&con[i].connect, cntxt);
  -        ap_make_time(&con[i].done, cntxt); 
  -    }
  -
       /* setup request */
       if (!posting) {
           sprintf(request, "GET %s HTTP/1.0\r\n"
  @@ -732,7 +726,7 @@
   #endif /*CHARSET_EBCDIC */
   
       /* ok - lets start */
  -    ap_current_time(start);
  +    start = ap_now();
   
       /* initialise lots of requests */
       for (i = 0; i < concurrency; i++) {
  @@ -745,8 +739,8 @@
           ap_int32_t timed;
   
           /* check for time limit expiry */
  -        ap_current_time(now);
  -        ap_timediff(now, start, &timed);
  +        now = ap_now();
  +	timed = (now - start) / AP_USEC_PER_SEC;
           if (tlimit && timed > (tlimit * 1000)) {
               requests = done;	/* so stats are correct */
           }
  @@ -896,9 +890,6 @@
       tdstring = "bgcolor=white";
   
       ap_create_context(&cntxt, NULL);
  -
  -    ap_make_time(&start, cntxt);
  -    ap_make_time(&endtime, cntxt);
   
       ap_optind = 1;
       while (ap_getopt(cntxt, argc, argv, "n:c:t:T:p:v:kVhwx:y:z:", &c) == APR_SUCCESS) {
  
  
  
  1.5       +17 -92    apache-2.0/src/lib/apr/test/testtime.c
  
  Index: testtime.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testtime.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- testtime.c	2000/01/06 19:19:28	1.4
  +++ testtime.c	2000/01/09 05:18:20	1.5
  @@ -63,113 +63,38 @@
   
   int main()
   {
  -    ap_context_t *context;
  -    ap_time_t *time;
  -    ap_time_t *time2;
  -    ap_int32_t rv = 0;
  -    ap_int64_t t1, t2;
  +    ap_time_t now;
  +    ap_exploded_time_t xt;
  +    ap_time_t imp;
   
  -    fprintf(stdout, "Creating context.......");
  -    if (ap_create_context(&context, NULL) != APR_SUCCESS) {
  -        fprintf(stderr, "could not create context\n");
  -        exit(-1);
  -    }
  -    fprintf(stdout, "OK\n");
  -
       fprintf(stdout, "Testing Time functions.\n");
   
  -    fprintf(stdout, "\tMaking new time variable.......");
  -    if (ap_make_time(&time, context) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't allocate memory\n");
  -        exit(-1);
  -    }
  +    fprintf(stdout, "\tap_now.......");
  +    now = ap_now();
       fprintf(stdout, "OK\n");
  -    
  -    fprintf(stdout, "\tGetting current time.......");
  -    if (ap_current_time(time) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the time\n");
  +
  +    fprintf(stdout, "\tap_explode_localtime.......");
  +    if (ap_explode_localtime(&xt, now) != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't explode the time\n");
           exit(-1);
       }
       fprintf(stdout, "OK\n");
       
  -    fprintf(stdout, "\tExploding Current time.......");
  -    if (ap_explode_time(time, APR_UTCTIME) != APR_SUCCESS) {
  +    fprintf(stdout, "\tap_explode_gmt.......");
  +    if (ap_explode_gmt(&xt, now) != APR_SUCCESS) {
           fprintf(stderr, "Couldn't explode the time\n");
           exit(-1);
       }
       fprintf(stdout, "OK\n");
   
  -    ap_make_time(&time2, context);
  -    fprintf(stdout, "\tGetting the number of seconds.......");
  -    if (ap_get_sec(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the seconds\n");
  +    fprintf(stdout, "\tap_implode_time........");
  +    if (ap_implode_time(&imp, &xt) != APR_SUCCESS) {
  +        fprintf(stderr, "Couldn't implode the time\n");
           exit(-1);
       }
  -    ap_set_sec(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the number of minutes.......");
  -    if (ap_get_min(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the minutes\n");
  -        exit(-1);
  -    }
  -    ap_set_min(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the number of hours.......");
  -    if (ap_get_hour(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the hours\n");
  -        exit(-1);
  -    }
  -    ap_set_hour(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the number of days.......");
  -    if (ap_get_mday(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the days\n");
  -        exit(-1);
  -    }
  -    ap_set_mday(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the month .......");
  -    if (ap_get_mon(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the month\n");
  -        exit(-1);
  -    }
  -    ap_set_mon(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the year.......");
  -    if (ap_get_year(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the year\n");
  -        exit(-1);
  -    }
  -    ap_set_year(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tGetting the weekday.......");
  -    if (ap_get_wday(time, &rv) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't get the week day\n");
  -        exit(-1);
  -    }
  -    ap_set_wday(time2, rv);
  -    fprintf(stdout, "OK\n"); 
  -
  -    fprintf(stdout, "\tImploding the time.......");
  -    if (ap_implode_time(time2) != APR_SUCCESS ||
  -        ap_implode_time(time) != APR_SUCCESS) {
  -        fprintf(stderr, "Couldn't implode time\n");
  -        exit(-1);
  -    }
  -    fprintf(stdout, "OK\n");
  -
  -    fprintf(stdout, "\tComparing two time values.......");
  -    ap_get_ansitime(time, &t1);
  -    ap_get_ansitime(time2, &t2);
  -    if ((t1 == -1) || (t2 == -1) || (t1 != t2)) {
  -        fprintf(stderr, "Values don't match\n");
  -        exit(-1);
  +    if (imp != now) {
  +	fprintf(stderr, "implode/explode mismatch\n");
  +	exit(-1);
       }
       fprintf(stdout, "OK\n");
   
  
  
  
  1.10      +0 -5      apache-2.0/src/lib/apr/time/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/Makefile.in,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Makefile.in	1999/12/20 20:03:17	1.9
  +++ Makefile.in	2000/01/09 05:18:21	1.10
  @@ -15,7 +15,6 @@
   #LIB=libtime.a
   
   OBJS=time.o \
  -	access.o \
   	timestr.o
   
   .c.o:
  @@ -51,10 +50,6 @@
   	    && rm Makefile.new
   
   # DO NOT REMOVE
  -access.o: access.c atime.h ../../include/apr_config.h \
  - ../../include/apr_time.h ../../include/apr_general.h \
  - ../../include/apr.h ../../include/apr_errno.h ../../include/apr_lib.h \
  - ../../include/apr_file_io.h ../../include/apr_thread_proc.h
   time.o: time.c atime.h ../../include/apr_config.h \
    ../../include/apr_time.h ../../include/apr_general.h \
    ../../include/apr.h ../../include/apr_errno.h ../../include/apr_lib.h \
  
  
  
  1.16      +109 -168  apache-2.0/src/lib/apr/time/unix/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/time.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- time.c	2000/01/06 20:20:25	1.15
  +++ time.c	2000/01/09 05:18:21	1.16
  @@ -57,107 +57,147 @@
   #include "apr_portable.h"
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_make_time(ap_context_t *, ap_time_t *)
  - *    Create an empty time entity.
  - * arg 1) The context to operate on.
  - * arg 2) The new time entity to create.
  + * ap_status_t ap_ansi_time_to_ap_time(ap_time_t *result, time_t input)
  + *    convert an ansi time_t to an ap_time_t
  + * arg 1) the resulting ap_time_t
  + * arg 2) the time_t to convert
    */
  -ap_status_t ap_make_time(struct atime_t **new, ap_context_t *cont)
  +ap_status_t ap_ansi_time_to_ap_time(ap_time_t *result, time_t input)
   {
  -    (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t));
  -
  -    if ((*new) == NULL) {
  -        return APR_ENOMEM;
  -    }
  -
  -    (*new)->cntxt = cont;
  -    (*new)->explodedtime = ap_palloc(cont, sizeof(struct tm));
  -    (*new)->time_ex = 0;
  -    (*new)->currtime = NULL;
  +    *result = (ap_time_t)input * AP_USEC_PER_SEC;
       return APR_SUCCESS;
   }
   
  +
   /* ***APRDOC********************************************************
  - * ap_status_t ap_make_init_time(ap_context_t *, ap_time_t *)
  - *    Create a time entity and fill it out with the current time.
  - * arg 1) The context to operate on.
  - * arg 2) The new time entity to create.
  + * ap_time_t ap_now(void)
  + *    return the current time
    */
  -ap_status_t ap_make_init_time(struct atime_t **new, ap_context_t *cont)
  +ap_time_t ap_now(void)
   {
  -    (*new) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t));
  +    struct timeval tv;
  +    gettimeofday(&tv, NULL);
  +    return tv.tv_sec * AP_USEC_PER_SEC + tv.tv_usec;
  +}
   
  -    if ((*new) == NULL) {
  -        return APR_ENOMEM;
  -    }
   
  -    (*new)->cntxt = cont;
  -    (*new)->explodedtime = ap_palloc(cont, sizeof(struct tm));
  -    (*new)->time_ex = 0;
  -    gettimeofday((*new)->currtime, NULL);
  -    return APR_SUCCESS;
  +static void tm_to_exp(ap_exploded_time_t *xt, struct tm *tm)
  +{
  +    xt->tm_sec  = tm->tm_sec;
  +    xt->tm_min  = tm->tm_min;
  +    xt->tm_hour = tm->tm_hour;
  +    xt->tm_mday = tm->tm_mday;
  +    xt->tm_mon  = tm->tm_mon;
  +    xt->tm_year = tm->tm_year;
  +    xt->tm_wday = tm->tm_wday;
  +    xt->tm_yday = tm->tm_yday;
  +    xt->tm_isdst = tm->tm_isdst;
   }
   
  +
   /* ***APRDOC********************************************************
  - * ap_status_t ap_current_time(ap_time_t *)
  - *    Return the number of seconds since January 1, 1970. 
  - * arg 1) The time entity to reference.
  + * ap_status_t ap_explode_gmt(ap_exploded_time_t *, ap_time_t)
  + *   convert a time to its human readable components in GMT timezone
  + * arg 1) the exploded time
  + * arg 2) the time to explode
    */
  -ap_status_t ap_current_time(struct atime_t *new)
  +ap_status_t ap_explode_gmt(ap_exploded_time_t *result, ap_time_t input)
   {
  -    new->currtime = ap_palloc(new->cntxt, sizeof(struct timeval));
  -    gettimeofday(new->currtime, NULL);
  -    new->time_ex = 0;
  -    return APR_SUCCESS; 
  -}       
  +    time_t t = input / AP_USEC_PER_SEC;
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
  +    struct tm banana;
  +#endif
  +
  +    result->tm_usec = input % AP_USEC_PER_SEC;
  +
  +#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
  +    gmtime_r(&t, &banana);
  +    tm_to_exp(result, &banana);
  +#else
  +    tm_to_exp(result, gmtime(&t));
  +#endif
  +    result->tm_gmtoff = 0;
  +    return APR_SUCCESS;
  +}
   
   /* ***APRDOC********************************************************
  - * ap_status_t ap_explode_time(ap_time_t *, ap_timetype_e)
  - *    Convert time value from number of seconds since epoch to a set
  - *    of integers representing the time in a human readable form.
  - * arg 1) The time entity to reference.
  - * arg 2) How to explode the time.  One of:
  - *            APR_LOCALTIME  -- Use local time
  - *            APR_UTCTIME    -- Use UTC time
  + * ap_status_t ap_explode_localtime(ap_exploded_time_t *, ap_time_t)
  + *   convert a time to its human readable components in local timezone
  + * arg 1) the exploded time
  + * arg 2) the time to explode
    */
  -ap_status_t ap_explode_time(struct atime_t *atime, ap_timetype_e type)
  +ap_status_t ap_explode_localtime(ap_exploded_time_t *result, ap_time_t input)
   {
  -    switch (type) {
  -    case APR_LOCALTIME: {
   #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
  -        localtime_r(&atime->currtime->tv_sec, atime->explodedtime);
  +    time_t t = input / AP_USEC_PER_SEC;
  +    struct tm apricot;
  +
  +    result->tm_usec = input % AP_USEC_PER_SEC;
  +
  +    localtime_r(&t, &apricot);
  +    tm_to_exp(result, &apricot);
  +#if defined(HAVE_GMTOFF)
  +    result->tm_gmtoff = apricot.tm_gmtoff;
  +#elif defined(HAVE___GMTOFF)
  +    result->tm_gmtoff = apricot.__tm_gmtoff;
   #else
  -        atime->explodedtime = localtime(&atime->currtime->tv_sec);
  -#endif
  -        break;
  +    /* solaris is backwards enough to have pthreads but no tm_gmtoff, feh */
  +    {
  +	int days, hours, minutes;
  +
  +	gmtime_r(&t, &apricot);
  +	days = result->tm_yday - apricot.tm_yday;
  +	hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
  +		+ result->tm_hour - apricot.tm_hour);
  +	minutes = hours * 60 + result->tm_min - apricot.tm_min;
  +	result->tm_gmtoff = minutes * 60;
       }
  -    case APR_UTCTIME: {
  -#if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS)
  -        gmtime_r(&atime->currtime->tv_sec, atime->explodedtime);
  -#else
  -        atime->explodedtime = gmtime(&atime->currtime->tv_sec);
   #endif
  -        break;
  -    }
  +#else
  +    time_t t = input / AP_USEC_PER_SEC;
  +    struct tm *tmx;
  +
  +    result->tm_usec = input % AP_USEC_PER_SEC;
  +
  +    tmx = localtime(&t);
  +    tm_to_exp(result, tmx);
  +#if defined(HAVE_GMTOFF)
  +    result->tm_gmtoff = tmx->tm_gmtoff;
  +#elif defined(HAVE___GMTOFF)
  +    result->tm_gmtoff = tmx->__tm_gmtoff;
  +#else
  +    /* need to create tm_gmtoff... assume we are never more than 24 hours away */
  +    {
  +	int days, hours, minutes;
  +
  +	tmx = gmtime(&t);
  +	days = result->tm_yday - tmx->tm_yday;
  +	hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
  +		+ result->tm_hour - tmx->tm_hour);
  +	minutes = hours * 60 + result->tm_min - tmx->tm_min;
  +	result->tm_gmtoff = minutes * 60;
       }
  -    atime->time_ex = 1;
  +#endif
  +#endif
       return APR_SUCCESS;
   }
   
  +
   /* ***APRDOC********************************************************
  - * ap_status_t ap_implode_time(ap_time_t *)
  + * ap_status_t ap_implode_time(ap_time_t *, ap_exploded_time_t *)
    *    Convert time value from human readable format to number of seconds 
    *    since epoch
  - * arg 1) The time entity to reference.
  + * arg 1) the resulting imploded time
  + * arg 2) the input exploded time
    */
  -ap_status_t ap_implode_time(struct atime_t *atime)
  +ap_status_t ap_implode_time(ap_time_t *t, ap_exploded_time_t *xt)
   {
       int year;
       time_t days;
       static const int dayoffset[12] =
       {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
   
  -    year = atime->explodedtime->tm_year;
  +    year = xt->tm_year;
   
       if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) {
           return APR_EBADDATE;
  @@ -165,120 +205,21 @@
   
       /* shift new year to 1st March in order to make leap year calc easy */
   
  -    if (atime->explodedtime->tm_mon < 2)
  +    if (xt->tm_mon < 2)
           year--;
   
       /* Find number of days since 1st March 1900 (in the Gregorian calendar). */
   
       days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4;
  -    days += dayoffset[atime->explodedtime->tm_mon] + 
  -            atime->explodedtime->tm_mday - 1;
  +    days += dayoffset[xt->tm_mon] + xt->tm_mday - 1;
       days -= 25508;              /* 1 jan 1970 is 25508 days since 1 mar 1900 */
   
  -    days = ((days * 24 + atime->explodedtime->tm_hour) * 60 + 
  -             atime->explodedtime->tm_min) * 60 + atime->explodedtime->tm_sec;
  +    days = ((days * 24 + xt->tm_hour) * 60 + xt->tm_min) * 60 + xt->tm_sec;
   
       if (days < 0) {
           return APR_EBADDATE;
       }
  -    atime->currtime = ap_palloc(atime->cntxt, sizeof(struct timeval));
  -    atime->currtime->tv_sec = days;            /* must be a valid time */
  -    atime->currtime->tv_usec = 0;
  -    atime->time_ex = 1;
  +    days -= xt->tm_gmtoff;
  +    *t = days * AP_USEC_PER_SEC + xt->tm_usec;
       return APR_SUCCESS;
   }
  -
  -/* ***APRDOC********************************************************
  - * ap_status_t ap_get_os_time(ap_os_time_t **, ap_time_t *)
  - *    Convert from apr time type to OS specific time value
  - * arg 1) The time value to convert.
  - * arg 2) The OS specific value to convert to.
  - */
  -ap_status_t ap_get_os_time(ap_os_time_t **atime, struct atime_t *thetime)
  -{
  -    if (thetime == NULL) {
  -        return APR_ENOTIME;
  -    }
  -    if (thetime->currtime == NULL) {
  -        ap_implode_time(thetime); 
  -    }
  -    atime = &(thetime->currtime);
  -    return APR_SUCCESS;
  -}
  -
  -/* ***APRDOC********************************************************
  - * ap_status_t ap_put_os_time(ap_time_t **, ap_os_time_t *, ap_context_t *)
  - *    Convert to apr time type from OS specific time value
  - * arg 1) The context to use.
  - * arg 2) The time value to convert to.
  - * arg 3) The OS specific value to convert.
  - */
  -ap_status_t ap_put_os_time(struct atime_t **thetime, ap_os_time_t *atime, 
  -                           ap_context_t *cont)
  -{
  -    if (cont == NULL) {
  -        return APR_ENOCONT;
  -    }
  -    if (thetime == NULL) {
  -        (*thetime) = (struct atime_t *)ap_palloc(cont, sizeof(struct atime_t));
  -        (*thetime)->cntxt = cont;
  -    }
  -    (*thetime)->currtime = atime;
  -    (*thetime)->time_ex = 0;
  -    return APR_SUCCESS;
  -}
  -
  -/* ***APRDOC********************************************************
  - * ap_status_t ap_timediff(ap_time_t *, ap_time_t *, ap_int32_t *)
  - *    Retrieve the difference between two time structures in milliseconds.
  - * arg 1) The first time value
  - * arg 2) The second timevalue
  - * arg 3) The difference to return.
  - */
  -ap_status_t ap_timediff(struct atime_t *a, struct atime_t *b, ap_int32_t *rv)
  -{
  -    register int us, s;
  -
  -    us = a->currtime->tv_usec - b->currtime->tv_usec;
  -    us /= 1000;
  -    s = a->currtime->tv_sec - b->currtime->tv_sec;
  -    s *= 1000;
  -    *rv = s + us;
  -    return APR_SUCCESS;
  -} 
  - 
  -/* ***APRDOC********************************************************
  - * ap_status_t ap_timecmp(ap_time_t **, ap_time_t *, ap_time_t *)
  - *     Compare two time values. 
  - * arg 1)  The first time value
  - * arg 2)  The second time value.
  - * return) APR_LESS  -- arg 1 < arg 2
  - *         APR_MORE  -- arg 1 > arg 2
  - *         APR_EQUAL -- arg 1 = arg 2
  - */
  -ap_status_t ap_timecmp(struct atime_t *a, struct atime_t *b)
  -{
  -    if (a == NULL || a->currtime == NULL) {
  -        return APR_LESS;
  -    }
  -    else if (b == NULL || b->currtime == NULL) {
  -        return APR_MORE;
  -    }
  -
  -    if (a->currtime->tv_sec > b->currtime->tv_sec) {
  -        return APR_MORE;
  -    }
  -    else if (a->currtime->tv_sec < b->currtime->tv_sec) {
  -        return APR_LESS;
  -    }
  -    else {
  -        if (a->currtime->tv_usec > b->currtime->tv_sec) {
  -            return APR_MORE;
  -        }
  -        else {
  -            return APR_LESS;
  -        }
  -    }
  -    return APR_EQUAL;
  -}
  - 
  
  
  
  1.5       +95 -56    apache-2.0/src/lib/apr/time/unix/timestr.c
  
  Index: timestr.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/timestr.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- timestr.c	1999/12/31 05:09:21	1.4
  +++ timestr.c	2000/01/09 05:18:21	1.5
  @@ -65,71 +65,110 @@
       "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
   };
   
  -ap_status_t ap_timestr(char **date_str, struct atime_t *t, ap_timetype_e type, ap_context_t *p)
  +ap_status_t ap_rfc822_date(char *date_str, ap_time_t t)
   {
  -    struct tm *tms;
  -    char *date_str_ptr;
  +    ap_exploded_time_t xt;
  +    const char *s;
       int real_year;
   
  -    (*date_str) = ap_palloc(p, 48 * sizeof(char));
  -    date_str_ptr = (*date_str);
  +    ap_explode_gmt(&xt, t);
   
  -    ap_explode_time(t, type);
  +    /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */
  +    /*           12345678901234567890123456789  */
   
  -    /* Assumption: this is always 3 */
  -    /* i = strlen(ap_day_snames[tms->tm_wday]); */
  -    memcpy(date_str_ptr, ap_day_snames[t->explodedtime->tm_wday], 3);
  -    date_str_ptr += 3;
  -    *date_str_ptr++ = ',';
  -    *date_str_ptr++ = ' ';
  -    *date_str_ptr++ = t->explodedtime->tm_mday / 10 + '0';
  -    *date_str_ptr++ = t->explodedtime->tm_mday % 10 + '0';
  -    *date_str_ptr++ = ' ';
  -    /* Assumption: this is also always 3 */
  -    /* i = strlen(ap_month_snames[tms->tm_mon]); */
  -    memcpy(date_str_ptr, ap_month_snames[t->explodedtime->tm_mon], 3);
  -    date_str_ptr += 3;
  -    *date_str_ptr++ = ' ';
  -    real_year = 1900 + t->explodedtime->tm_year;
  +    s = &ap_day_snames[xt.tm_wday][0];
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = ',';
  +    *date_str++ = ' ';
  +    *date_str++ = xt.tm_mday / 10 + '0';
  +    *date_str++ = xt.tm_mday % 10 + '0';
  +    *date_str++ = ' ';
  +    s = &ap_month_snames[xt.tm_mon][0];
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = ' ';
  +    real_year = 1900 + xt.tm_year;
       /* This routine isn't y10k ready. */
  -    *date_str_ptr++ = real_year / 1000 + '0';
  -    *date_str_ptr++ = real_year % 1000 / 100 + '0';
  -    *date_str_ptr++ = real_year % 100 / 10 + '0';
  -    *date_str_ptr++ = real_year % 10 + '0';
  -    *date_str_ptr++ = ' ';
  -    *date_str_ptr++ = t->explodedtime->tm_hour / 10 + '0';
  -    *date_str_ptr++ = t->explodedtime->tm_hour % 10 + '0';
  -    *date_str_ptr++ = ':';
  -    *date_str_ptr++ = t->explodedtime->tm_min / 10 + '0';
  -    *date_str_ptr++ = t->explodedtime->tm_min % 10 + '0';
  -    *date_str_ptr++ = ':';
  -    *date_str_ptr++ = t->explodedtime->tm_sec / 10 + '0';
  -    *date_str_ptr++ = t->explodedtime->tm_sec % 10 + '0';
  -    if (type == APR_UTCTIME) {
  -        *date_str_ptr++ = ' ';
  -        *date_str_ptr++ = 'G';
  -        *date_str_ptr++ = 'M';
  -        *date_str_ptr++ = 'T';
  -    }
  -    *date_str_ptr = '\0';
  -                                                                                    return APR_SUCCESS;
  -    /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */
  -
  -    /* The equivalent using sprintf. Use this for more legible but slower code
  -    return ap_psprintf(p,
  -                "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", 
  -                ap_day_snames[t->explodedtime->tm_wday], 
  -                t->explodedtime->tm_mday, 
  -                ap_month_snames[t->explodedtime->tm_mon], 
  -                t->explodedtime->tm_year + 1900, t->explodedtime->tm_hour, 
  -                t->explodedtime->tm_min, t->explodedtime->tm_sec);
  -    */
  +    *date_str++ = real_year / 1000 + '0';
  +    *date_str++ = real_year % 1000 / 100 + '0';
  +    *date_str++ = real_year % 100 / 10 + '0';
  +    *date_str++ = real_year % 10 + '0';
  +    *date_str++ = ' ';
  +    *date_str++ = xt.tm_hour / 10 + '0';
  +    *date_str++ = xt.tm_hour % 10 + '0';
  +    *date_str++ = ':';
  +    *date_str++ = xt.tm_min / 10 + '0';
  +    *date_str++ = xt.tm_min % 10 + '0';
  +    *date_str++ = ':';
  +    *date_str++ = xt.tm_sec / 10 + '0';
  +    *date_str++ = xt.tm_sec % 10 + '0';
  +    *date_str++ = ' ';
  +    *date_str++ = 'G';
  +    *date_str++ = 'M';
  +    *date_str++ = 'T';
  +    *date_str++ = 0;
  +    return APR_SUCCESS;
   }
   
  -ap_status_t ap_strftime(char *s, ap_size_t *retsize, ap_size_t max, 
  -                        const char *format, struct atime_t *tm)
  +ap_status_t ap_ctime(char *date_str, ap_time_t t)
   {
  -    (*retsize) = strftime(s, max, format, tm->explodedtime);
  +    ap_exploded_time_t xt;
  +    const char *s;
  +    int real_year;
  +
  +    /* example: "Wed Jun 30 21:49:08 1993" */
  +    /*           123456789012345678901234  */
  +
  +    ap_explode_localtime(&xt, t);
  +    s = &ap_day_snames[xt.tm_wday][0];
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = ' ';
  +    s = &ap_month_snames[xt.tm_mon][0];
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = *s++;
  +    *date_str++ = ' ';
  +    *date_str++ = xt.tm_mday / 10 + '0';
  +    *date_str++ = xt.tm_mday % 10 + '0';
  +    *date_str++ = ' ';
  +    *date_str++ = xt.tm_hour / 10 + '0';
  +    *date_str++ = xt.tm_hour % 10 + '0';
  +    *date_str++ = ':';
  +    *date_str++ = xt.tm_min / 10 + '0';
  +    *date_str++ = xt.tm_min % 10 + '0';
  +    *date_str++ = ':';
  +    *date_str++ = xt.tm_sec / 10 + '0';
  +    *date_str++ = xt.tm_sec % 10 + '0';
  +    *date_str++ = ' ';
  +    real_year = 1900 + xt.tm_year;
  +    *date_str++ = real_year / 1000 + '0';
  +    *date_str++ = real_year % 1000 / 100 + '0';
  +    *date_str++ = real_year % 100 / 10 + '0';
  +    *date_str++ = real_year % 10 + '0';
  +    *date_str++ = 0;
  +
       return APR_SUCCESS;
   }
   
  +ap_status_t ap_strftime(char *s, ap_size_t *retsize, ap_size_t max, 
  +                        const char *format, ap_exploded_time_t *xt)
  +{
  +    struct tm tm;
  +
  +    tm.tm_sec  = xt->tm_sec;
  +    tm.tm_min  = xt->tm_min;
  +    tm.tm_hour = xt->tm_hour;
  +    tm.tm_mday = xt->tm_mday;
  +    tm.tm_mon  = xt->tm_mon;
  +    tm.tm_year = xt->tm_year;
  +    tm.tm_wday = xt->tm_wday;
  +    tm.tm_yday = xt->tm_yday;
  +    tm.tm_isdst = xt->tm_isdst;
  +    (*retsize) = strftime(s, max, format, &tm);
  +    return APR_SUCCESS;
  +}
  
  
  
  1.31      +0 -1      apache-2.0/src/main/http_core.c
  
  Index: http_core.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_core.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- http_core.c	2000/01/06 14:43:26	1.30
  +++ http_core.c	2000/01/09 05:18:22	1.31
  @@ -2453,7 +2453,6 @@
   {
       core_dir_config *d =
   	    (core_dir_config *)ap_get_module_config(r->per_dir_config, &core_module);
  -    ap_time_t *temp;
       int rangestatus, errstatus;
       ap_file_t *fd = NULL;
       ap_status_t status;
  
  
  
  1.25      +9 -2      apache-2.0/src/main/http_log.c
  
  Index: http_log.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- http_log.c	2000/01/06 14:43:26	1.24
  +++ http_log.c	2000/01/09 05:18:23	1.25
  @@ -359,7 +359,11 @@
       }
   
       if (logf && ((level & APLOG_STARTUP) != APLOG_STARTUP)) {
  -	len = ap_snprintf(errstr, MAX_STRING_LEN, "[%s] ", ap_get_time());
  +	errstr[0] = '[';
  +	ap_ctime(errstr + 1, ap_now());
  +	errstr[1 + AP_CTIME_LEN - 1] = ']';
  +	errstr[1 + AP_CTIME_LEN    ] = ' ';
  +	len = 1 + AP_CTIME_LEN + 1;
       } else {
   	len = 0;
       }
  @@ -581,9 +585,12 @@
   
   API_EXPORT(void) ap_log_assert(const char *szExp, const char *szFile, int nLine)
   {
  +    char time_str[AP_CTIME_LEN];
  +
  +    ap_ctime(time_str, ap_now());
       ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL,
                    "[%s] file %s, line %d, assertion \"%s\" failed",
  -	         ap_get_time(), szFile, nLine, szExp);
  +	         time_str, szFile, nLine, szExp);
   #ifndef WIN32
       /* unix assert does an abort leading to a core dump */
       abort();
  
  
  
  1.46      +21 -40    apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- http_protocol.c	2000/01/06 14:43:27	1.45
  +++ http_protocol.c	2000/01/09 05:18:23	1.46
  @@ -368,9 +368,9 @@
    * to limit the number of calls to time().  We don't check for futurosity
    * unless the mtime is at least as new as the reference.
    */
  -API_EXPORT(ap_time_t *) ap_rationalize_mtime(request_rec *r, ap_time_t *mtime)
  +API_EXPORT(ap_time_t) ap_rationalize_mtime(request_rec *r, ap_time_t mtime)
   {
  -    ap_time_t *now;
  +    ap_time_t now;
   
       /* For all static responses, it's almost certain that the file was
        * last modified before the beginning of the request.  So there's
  @@ -381,26 +381,15 @@
        * were given a time in the future, we return the current time - the
        * Last-Modified can't be in the future.
        */
  -    if (ap_timecmp(mtime, r->request_time) == APR_LESS) {
  -        now = r->request_time;
  -    }
  -    else {
  -        ap_make_time(&now, r->pool);
  -        ap_current_time(now);
  -    } 
  -    if (ap_timecmp(mtime, now) == APR_MORE) {
  -        return now;
  -    }
  -    else {
  -        return mtime;
  -    }
  +    now = (mtime < r->request_time) ? r->request_time : ap_now();
  +    return (mtime > now) ? now : mtime;
   }
   
   API_EXPORT(int) ap_meets_conditions(request_rec *r)
   {
       const char *etag = ap_table_get(r->headers_out, "ETag");
       const char *if_match, *if_modified_since, *if_unmodified, *if_nonematch;
  -    ap_time_t *mtime;
  +    ap_time_t mtime;
   
       /* Check for conditional requests --- note that we only want to do
        * this if we are successful so far and we are not processing a
  @@ -417,13 +406,8 @@
           return OK;
       }
   
  -    if (r->mtime == NULL) {
  -        ap_make_time(&mtime, r->pool);
  -        ap_current_time(mtime);
  -    }
  -    else {
  -        mtime = r->mtime;
  -    }
  +    /* XXX: we should define a "time unset" constant */
  +    mtime = (r->mtime != 0) ? r->mtime : ap_now();
   
       /* If an If-Match request-header field was given
        * AND the field value is not "*" (meaning match anything)
  @@ -445,9 +429,9 @@
            */
           if_unmodified = ap_table_get(r->headers_in, "If-Unmodified-Since");
           if (if_unmodified != NULL) {
  -            ap_time_t *ius = ap_parseHTTPdate(if_unmodified, r->pool);
  +            ap_time_t ius = ap_parseHTTPdate(if_unmodified);
   
  -            if ((ius != NULL) && (ap_timecmp(mtime, ius) == APR_MORE)) {
  +            if ((ius != BAD_DATE) && (mtime > ius)) {
                   return HTTP_PRECONDITION_FAILED;
               }
           }
  @@ -498,10 +482,9 @@
       else if ((r->method_number == M_GET)
                && ((if_modified_since =
                     ap_table_get(r->headers_in, "If-Modified-Since")) != NULL)) {
  -        ap_time_t *ims = ap_parseHTTPdate(if_modified_since, r->pool);
  +        ap_time_t ims = ap_parseHTTPdate(if_modified_since);
   
  -        if (!ap_timecmp(ims, mtime) < APR_LESS && 
  -            !ap_timecmp(ims, r->request_time) > APR_MORE) {
  +	if ((ims >= mtime) && (ims <= r->request_time)) {
               return HTTP_NOT_MODIFIED;
           }
       }
  @@ -519,7 +502,6 @@
   {
       char *etag;
       char *weak;
  -    int diff;
   
       /*
        * Make an ETag header out of various pieces of information. We use
  @@ -534,8 +516,7 @@
        * would be incorrect.
        */
       
  -    ap_timediff(r->request_time, r->mtime, &diff);
  -    weak = ((diff > 1) && !force_weak) ? "" : "W/";
  +    weak = ((r->request_time - r->mtime > AP_USEC_PER_SEC) && !force_weak) ? "" : "W/";
   
       if (r->finfo.protection != 0) {
           etag = ap_psprintf(r->pool,
  @@ -603,9 +584,9 @@
    */
   API_EXPORT(void) ap_set_last_modified(request_rec *r)
   {
  -    ap_time_t *mod_time = ap_rationalize_mtime(r, r->mtime);
  -    char *datestr;
  -    ap_timestr(&datestr, mod_time, APR_UTCTIME, r->pool);
  +    ap_time_t mod_time = ap_rationalize_mtime(r, r->mtime);
  +    char *datestr = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
  +    ap_rfc822_date(datestr, mod_time);
       ap_table_setn(r->headers_out, "Last-Modified", datestr);
   }
   
  @@ -822,7 +803,7 @@
   	    /* this is a hack to make sure that request time is set,
   	     * it's not perfect, but it's better than nothing 
   	     */
  -	    ap_current_time(r->request_time);
  +	    r->request_time = ap_now();
               return 0;
           }
       }
  @@ -841,7 +822,7 @@
   
       /* //ap_bsetflag(conn->client, B_SAFEREAD, 0); */
   
  -    ap_current_time(r->request_time);
  +    r->request_time = ap_now();
       r->the_request = ap_pstrdup(r->pool, l);
       r->method = ap_getword_white(r->pool, &ll);
       ap_update_connection_status(conn->id, "Method", r->method);
  @@ -975,8 +956,6 @@
   
       r->status          = HTTP_REQUEST_TIME_OUT;  /* Until we get a request */
       r->the_request     = NULL;
  -    ap_make_time(&r->request_time, r->pool);
  -    ap_make_time(&r->mtime, r->pool);
   
   #ifdef CHARSET_EBCDIC
       ap_bsetflag(r->connection->client, B_ASCII2EBCDIC|B_EBCDIC2ASCII, 1);
  @@ -1362,7 +1341,8 @@
   
       ap_rvputs(r, protocol, " ", r->status_line, "\015\012", NULL);
   
  -    ap_timestr(&date, r->request_time, APR_UTCTIME, r->pool);
  +    date = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
  +    ap_rfc822_date(date, r->request_time);
       ap_send_header_field(r, "Date", date);
       ap_send_header_field(r, "Server", ap_get_server_version());
   
  @@ -1645,7 +1625,8 @@
        * some other part of the server configuration.
        */
       if (r->no_cache && !ap_table_get(r->headers_out, "Expires")) {
  -        ap_timestr(&date, r->request_time, APR_UTCTIME, r->pool);
  +	date = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
  +        ap_rfc822_date(date, r->request_time);
           ap_table_addn(r->headers_out, "Expires", date);
       }
   
  
  
  
  1.14      +3 -4      apache-2.0/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_request.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- http_request.c	2000/01/06 19:16:07	1.13
  +++ http_request.c	2000/01/09 05:18:23	1.14
  @@ -1374,10 +1374,9 @@
    * Function to set the r->mtime field to the specified value if it's later
    * than what's already there.
    */
  -API_EXPORT(ap_time_t *) ap_update_mtime(request_rec *r, ap_time_t *dependency_mtime)
  +API_EXPORT(void) ap_update_mtime(request_rec *r, ap_time_t dependency_mtime)
   {
  -    if (ap_timecmp(r->mtime, dependency_mtime) == APR_LESS) {
  -        r->mtime = dependency_mtime;
  +    if (r->mtime < dependency_mtime) {
  +	r->mtime = dependency_mtime;
       }
  -    return r->mtime;
   }
  
  
  
  1.25      +10 -22    apache-2.0/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- util.c	2000/01/06 14:43:28	1.24
  +++ util.c	2000/01/09 05:18:24	1.25
  @@ -92,18 +92,6 @@
    */
   #define TEST_CHAR(c, f)	(test_char_table[(unsigned)(c)] & (f))
   
  -API_EXPORT(char *) ap_get_time()
  -{
  -    ap_time_t *t = NULL;
  -    char *time_string = NULL;
  -
  -    ap_make_time(&t, NULL);
  -    ap_current_time(t);
  -
  -    ap_timestr(&time_string, t, APR_LOCALTIME, NULL);
  -    return (time_string);
  -}
  -
   /*
    * Examine a field value (such as a media-/content-type) string and return
    * it sans any parameters; e.g., strip off any ';charset=foo' and the like.
  @@ -124,25 +112,22 @@
       }
   }
   
  -API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, int gmt)
  +API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t t, const char *fmt, int gmt)
   {
       ap_int32_t retcode;
       char ts[MAX_STRING_LEN];
       char tf[MAX_STRING_LEN];
  +    ap_exploded_time_t xt;
   
       if (gmt) {
  -        ap_explode_time(t, APR_UTCTIME);
  -    }
  -    else {
  -        ap_explode_time(t, APR_LOCALTIME);
  -    }
  -    if(gmt) {
  +	const char *f;
  +	char *strp;
  +
  +        ap_explode_gmt(&xt, t);
   	/* Convert %Z to "GMT" and %z to "+0000";
   	 * on hosts that do not have a time zone string in struct tm,
   	 * strftime must assume its argument is local time.
   	 */
  -	const char *f;
  -	char *strp;
   	for(strp = tf, f = fmt; strp < tf + sizeof(tf) - 6 && (*strp = *f)
   	    ; f++, strp++) {
   	    if (*f != '%') continue;
  @@ -169,9 +154,12 @@
   	*strp = '\0';
   	fmt = tf;
       }
  +    else {
  +        ap_explode_localtime(&xt, t);
  +    }
   
       /* check return code? */
  -    ap_strftime(ts, &retcode, MAX_STRING_LEN, fmt, t);
  +    ap_strftime(ts, &retcode, MAX_STRING_LEN, fmt, &xt);
       ts[MAX_STRING_LEN - 1] = '\0';
       return ap_pstrdup(p, ts);
   }
  
  
  
  1.8       +46 -52    apache-2.0/src/main/util_date.c
  
  Index: util_date.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_date.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- util_date.c	1999/12/21 21:41:48	1.7
  +++ util_date.c	2000/01/09 05:18:24	1.8
  @@ -125,6 +125,7 @@
       return 0;			/* We only get here if mask is corrupted (exceeds 256) */
   }
   
  +
   /*
    * Parses an HTTP date in one of three standard forms:
    *
  @@ -172,16 +173,12 @@
    * but many changes since then.
    *
    */
  -API_EXPORT(ap_time_t *) ap_parseHTTPdate(const char *date, ap_context_t *cont)
  +API_EXPORT(ap_time_t) ap_parseHTTPdate(const char *date)
   {
  -    ap_int32_t year;
  -    ap_int32_t mday;
  -    ap_int32_t hour;
  -    ap_int32_t min;
  -    ap_int32_t sec;
  +    ap_exploded_time_t ds;
  +    ap_time_t result;
       int mint, mon;
       const char *monstr, *timstr;
  -    ap_time_t *temp;
       static const int months[12] =
       {
   	('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b',
  @@ -192,99 +189,96 @@
   	('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c'};
   
       if (!date)
  -	return NULL;
  +	return BAD_DATE;
   
       while (*date && ap_isspace(*date))	/* Find first non-whitespace char */
   	++date;
   
       if (*date == '\0')
  -	return NULL;
  +	return BAD_DATE;
   
       if ((date = strchr(date, ' ')) == NULL)	/* Find space after weekday */
  -	return NULL;
  +	return BAD_DATE;
   
       ++date;			/* Now pointing to first char after space, which should be */
       /* start of the actual date information for all 3 formats. */
   
       if (ap_checkmask(date, "## @$$ #### ##:##:## *")) {	/* RFC 1123 format */
  -	year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
  -	if (year < 0)
  -	    return NULL;
  +	ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100;
  +	if (ds.tm_year < 0)
  +	    return BAD_DATE;
   
  -	year += ((date[9] - '0') * 10) + (date[10] - '0');
  +	ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0');
   
  -	mday = ((date[0] - '0') * 10) + (date[1] - '0');
  +	ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0');
   
   	monstr = date + 3;
   	timstr = date + 12;
       }
       else if (ap_checkmask(date, "##-@$$-## ##:##:## *")) {		/* RFC 850 format  */
  -	year = ((date[7] - '0') * 10) + (date[8] - '0');
  -	if (year < 70)
  -	    year += 100;
  +	ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0');
  +	if (ds.tm_year < 70)
  +	    ds.tm_year += 100;
   
  -	mday = ((date[0] - '0') * 10) + (date[1] - '0');
  +	ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0');
   
   	monstr = date + 3;
   	timstr = date + 10;
       }
       else if (ap_checkmask(date, "@$$ ~# ##:##:## ####*")) {	/* asctime format  */
  -	year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100;
  -	if (year < 0)
  -	    return NULL;
  +	ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100;
  +	if (ds.tm_year < 0)
  +	    return BAD_DATE;
   
  -	year += ((date[18] - '0') * 10) + (date[19] - '0');
  +	ds.tm_year += ((date[18] - '0') * 10) + (date[19] - '0');
   
   	if (date[4] == ' ')
  -	    mday = 0;
  +	    ds.tm_mday = 0;
   	else
  -	    mday = (date[4] - '0') * 10;
  +	    ds.tm_mday = (date[4] - '0') * 10;
   
  -	mday += (date[5] - '0');
  +	ds.tm_mday += (date[5] - '0');
   
   	monstr = date;
   	timstr = date + 7;
       }
       else
  -	return NULL;
  +	return BAD_DATE;
   
  -    if (mday <= 0 || mday > 31)
  -	return NULL;
  +    if (ds.tm_mday <= 0 || ds.tm_mday > 31)
  +	return BAD_DATE;
   
  -    hour = ((timstr[0] - '0') * 10) + (timstr[1] - '0');
  -    min  = ((timstr[3] - '0') * 10) + (timstr[4] - '0');
  -    sec  = ((timstr[6] - '0') * 10) + (timstr[7] - '0');
  +    ds.tm_hour = ((timstr[0] - '0') * 10) + (timstr[1] - '0');
  +    ds.tm_min = ((timstr[3] - '0') * 10) + (timstr[4] - '0');
  +    ds.tm_sec = ((timstr[6] - '0') * 10) + (timstr[7] - '0');
   
  -    if ((hour > 23) || (min > 59) || (sec > 61))
  -	return NULL;
  +    if ((ds.tm_hour > 23) || (ds.tm_min > 59) || (ds.tm_sec > 61))
  +	return BAD_DATE;
   
       mint = (monstr[0] << 16) | (monstr[1] << 8) | monstr[2];
       for (mon = 0; mon < 12; mon++)
   	if (mint == months[mon])
   	    break;
       if (mon == 12)
  -	return NULL;
  +	return BAD_DATE;
   
  -    if ((mday == 31) && (mon == 3 || mon == 5 || mon == 8 || mon == 10))
  -	return NULL;
  +    if ((ds.tm_mday == 31) && (mon == 3 || mon == 5 || mon == 8 || mon == 10))
  +	return BAD_DATE;
   
       /* February gets special check for leapyear */
   
       if ((mon == 1) &&
  -	((mday > 29)
  -	 || ((mday == 29)
  -	     && ((year & 3)
  -		 || (((year % 100) == 0)
  -		     && (((year % 400) != 100)))))))
  -	return NULL;
  -
  -    ap_make_time(&temp, cont);
  -    ap_set_year(temp, year);
  -    ap_set_mday(temp, mday);
  -    ap_set_hour(temp, hour);
  -    ap_set_min(temp, min);
  -    ap_set_sec(temp, sec);
  -    ap_set_mon(temp, mon);
  +	((ds.tm_mday > 29)
  +	 || ((ds.tm_mday == 29)
  +	     && ((ds.tm_year & 3)
  +		 || (((ds.tm_year % 100) == 0)
  +		     && (((ds.tm_year % 400) != 100)))))))
  +	return BAD_DATE;
  +
  +    ds.tm_mon = mon;
   
  -    return temp;
  +    if (ap_implode_time(&result, &ds) != APR_SUCCESS) {
  +	return BAD_DATE;
  +    }
  +    return result;
   }
  
  
  
  1.22      +1 -3      apache-2.0/src/main/util_script.c
  
  Index: util_script.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/util_script.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- util_script.c	1999/12/31 01:27:43	1.21
  +++ util_script.c	2000/01/09 05:18:24	1.22
  @@ -589,9 +589,7 @@
   	 * pass it on blindly because of restrictions on future values.
   	 */
   	else if (!strcasecmp(w, "Last-Modified")) {
  -	    ap_time_t *mtime = ap_parseHTTPdate(l, r->pool);
  -
  -	    ap_update_mtime(r, mtime);
  +	    ap_update_mtime(r, ap_parseHTTPdate(l));
   	    ap_set_last_modified(r);
   	}
   	else if (!strcasecmp(w, "Set-Cookie")) {
  
  
  
  1.6       +8 -10     apache-2.0/src/modules/experimental/Makefile.tmpl
  
  Index: Makefile.tmpl
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/experimental/Makefile.tmpl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile.tmpl	1999/11/20 12:55:26	1.5
  +++ Makefile.tmpl	2000/01/09 05:18:29	1.6
  @@ -7,18 +7,16 @@
   mod_mmap_static.o: mod_mmap_static.c $(INCDIR)/httpd.h \
    $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
    $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
  - $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
  - ../../lib/apr/include/apr_general.h \
  - ../../lib/apr/include/apr_config.h ../../lib/apr/include/apr_errno.h \
  + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \
  + $(INCDIR)/hsregex.h ../../lib/apr/include/apr_general.h \
  + ../../lib/apr/include/apr.h ../../lib/apr/include/apr_errno.h \
    ../../lib/apr/include/apr_lib.h ../../lib/apr/include/apr_file_io.h \
  - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \
  - $(INCDIR)/apr.h $(INCDIR)/util_uri.h \
  + ../../lib/apr/include/apr_time.h \
  + ../../lib/apr/include/apr_thread_proc.h $(INCDIR)/buff.h \
  + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h $(INCDIR)/util_uri.h \
    $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \
    $(INCDIR)/http_log.h $(INCDIR)/http_protocol.h \
    ../../lib/apr/include/apr_portable.h \
  - ../../lib/apr/include/apr_thread_proc.h \
  - ../../lib/apr/include/apr_win.h \
    ../../lib/apr/include/apr_network_io.h \
  - ../../lib/apr/include/apr_lock.h ../../lib/apr/include/apr_time.h \
  - ../../lib/apr/include/apr_mmap.h $(INCDIR)/http_request.h \
  - $(INCDIR)/http_core.h
  + ../../lib/apr/include/apr_lock.h ../../lib/apr/include/apr_mmap.h \
  + $(INCDIR)/http_request.h $(INCDIR)/http_core.h
  
  
  
  1.19      +5 -6      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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mod_autoindex.c	2000/01/07 20:38:05	1.18
  +++ mod_autoindex.c	2000/01/09 05:18:29	1.19
  @@ -678,7 +678,7 @@
       char *alt;
       char *desc;
       off_t size;
  -    time_t lm;
  +    ap_time_t lm;
       struct ent *next;
       int ascending;
       char key;
  @@ -1162,7 +1162,7 @@
           request_rec *rr = ap_sub_req_lookup_file(name, r);
   
   	if (rr->finfo.protection != 0) {
  -	    ap_get_ansitime(rr->finfo.mtime, (ap_int64_t *)&p->lm);
  +	    p->lm = rr->finfo.mtime;
   	    if (S_ISDIR(rr->finfo.protection)) {
   	        if (!(p->icon = find_icon(d, rr, 1))) {
   		    p->icon = find_default_icon(d, "^^DIRECTORY^^");
  @@ -1404,11 +1404,10 @@
   	    if (!(autoindex_opts & SUPPRESS_LAST_MOD)) {
   		if (ar[x]->lm != -1) {
   		    char time_str[MAX_STRING_LEN];
  -		    ap_time_t *ts = NULL;
  -                    ap_make_time(&ts, r->pool);
  -                    ap_set_ansitime(ts, ar[x]->lm);
  +		    ap_exploded_time_t ts;
  +                    ap_explode_localtime(&ts, ar[x]->lm);
   		    ap_strftime(time_str, &rv, MAX_STRING_LEN, 
  -                                "%d-%b-%Y %H:%M  ", ts);
  +                                "%d-%b-%Y %H:%M  ", &ts);
   		    ap_rputs(time_str, r);
   		}
   		else {
  
  
  
  1.24      +6 -2      apache-2.0/src/modules/standard/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- mod_cgi.c	2000/01/06 14:43:38	1.23
  +++ mod_cgi.c	2000/01/09 05:18:30	1.24
  @@ -168,6 +168,7 @@
   {
       ap_file_t *f = NULL;
       struct stat finfo;
  +    char time_str[AP_CTIME_LEN];
   
       ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
   		"%s: %s", error, r->filename);
  @@ -181,7 +182,8 @@
       }
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
  -    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri,
  +    ap_ctime(time_str, ap_now());
  +    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri,
   	    r->args ? "?" : "", r->args ? r->args : "", r->protocol);
       /* "%% 500 /usr/local/apache/cgi-bin */
       ap_fprintf(f, "%%%% %d %s\n", ret, r->filename);
  @@ -201,6 +203,7 @@
       ap_file_t *f = NULL;
       int i;
       struct stat finfo;
  +    char time_str[AP_CTIME_LEN];
   
       if (!conf->logname ||
   	((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0)
  @@ -227,7 +230,8 @@
       }
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgi-bin/printenv HTTP/1.0" */
  -    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri,
  +    ap_ctime(time_str, ap_now());
  +    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri,
   	    r->args ? "?" : "", r->args ? r->args : "", r->protocol);
       /* "%% 500 /usr/local/apache/cgi-bin" */
       ap_fprintf(f, "%%%% %d %s\n", ret, r->filename);
  
  
  
  1.3       +6 -2      apache-2.0/src/modules/standard/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgid.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mod_cgid.c	2000/01/04 19:01:01	1.2
  +++ mod_cgid.c	2000/01/09 05:18:30	1.3
  @@ -668,6 +668,7 @@
   { 
       ap_file_t *f = NULL; 
       struct stat finfo; 
  +    char time_str[AP_CTIME_LEN];
   
       ap_log_rerror(APLOG_MARK, show_errno|APLOG_ERR, errno, r, 
                   "%s: %s", error, r->filename); 
  @@ -681,7 +682,8 @@
       } 
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ 
  -    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, 
  +    ap_ctime(time_str, ap_now());
  +    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, 
               r->args ? "?" : "", r->args ? r->args : "", r->protocol); 
       /* "%% 500 /usr/local/apache/cgid-bin */ 
       ap_fprintf(f, "%%%% %d %s\n", ret, r->filename); 
  @@ -701,6 +703,7 @@
       ap_file_t *f = NULL; 
       int i; 
       struct stat finfo; 
  +    char time_str[AP_CTIME_LEN];
   
       if (!conf->logname || 
           ((stat(ap_server_root_relative(r->pool, conf->logname), &finfo) == 0) 
  @@ -716,7 +719,8 @@
       } 
   
       /* "%% [Wed Jun 19 10:53:21 1996] GET /cgid-bin/printenv HTTP/1.0" */ 
  -    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", ap_get_time(), r->method, r->uri, 
  +    ap_ctime(time_str, ap_now());
  +    ap_fprintf(f, "%%%% [%s] %s %s%s%s %s\n", time_str, r->method, r->uri, 
               r->args ? "?" : "", r->args ? r->args : "", r->protocol); 
       /* "%% 500 /usr/local/apache/cgid-bin" */ 
       ap_fprintf(f, "%%%% %d %s\n", ret, r->filename); 
  
  
  
  1.8       +12 -16    apache-2.0/src/modules/standard/mod_expires.c
  
  Index: mod_expires.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_expires.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- mod_expires.c	2000/01/07 15:52:18	1.7
  +++ mod_expires.c	2000/01/09 05:18:30	1.8
  @@ -196,6 +196,7 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_log.h"
  +#include "http_request.h"
   
   typedef struct {
       int active;
  @@ -402,12 +403,10 @@
   {
       expires_dir_config *conf;
       char *code;
  -    char *timestr = NULL;
  -    ap_ansi_time_t base;
  -    time_t additional;
  -    time_t expires;
  -    ap_time_t *finaltime = NULL;
  -    char age[20];
  +    ap_time_t base;
  +    ap_time_t additional;
  +    ap_time_t expires;
  +    char *timestr;
   
       if (ap_is_HTTP_ERROR(r->status))       /* Don't add Expires headers to errors */
           return DECLINED;
  @@ -459,14 +458,14 @@
   	     */
   	    return DECLINED;
   	}
  -        ap_get_ansitime(r->finfo.mtime, &base);
  +	base = r->finfo.mtime;
           additional = atoi(&code[1]);
           break;
       case 'A':
           /* there's been some discussion and it's possible that 
            * 'access time' will be stored in request structure
            */
  -        ap_get_ansitime(r->request_time, &base);
  +        base = r->request_time;
           additional = atoi(&code[1]);
           break;
       default:
  @@ -479,14 +478,11 @@
       };
   
       expires = base + additional;
  -    ap_snprintf(age, sizeof(age), "max-age=%d", (int) expires - (int) r->request_time);
  -    ap_table_setn(r->headers_out, "Cache-Control", ap_pstrdup(r->pool, age));
  -    tzset();                    /* redundant? called implicitly by localtime, at least 
  -                                 * under FreeBSD
  -                                 */
  -    ap_make_time(&finaltime, r->pool);
  -    ap_set_ansitime(finaltime, expires);
  -    ap_timestr(&timestr, finaltime, APR_UTCTIME, r->pool); 
  +    ap_table_setn(r->headers_out, "Cache-Control",
  +	ap_psprintf(r->pool, "max-age=%qd",
  +	    (expires - r->request_time) / AP_USEC_PER_SEC));
  +    timestr = ap_palloc(r->pool, AP_RFC822_DATE_LEN);
  +    ap_rfc822_date(timestr, expires);
       ap_table_setn(r->headers_out, "Expires", timestr);
       return OK;
   }
  
  
  
  1.17      +5 -8      apache-2.0/src/modules/standard/mod_include.c
  
  Index: mod_include.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_include.c	2000/01/06 19:19:38	1.16
  +++ mod_include.c	2000/01/09 05:18:30	1.17
  @@ -124,10 +124,8 @@
   #endif /* ndef WIN32 */
       ap_table_t *e = r->subprocess_env;
       char *t;
  -    ap_time_t *date = r->request_time;
  -    ap_time_t *mtime = NULL;
  +    ap_time_t date = r->request_time;
   
  -
       ap_table_setn(e, "DATE_LOCAL", ap_ht_time(r->pool, date, timefmt, 0));
       ap_table_setn(e, "DATE_GMT", ap_ht_time(r->pool, date, timefmt, 1));
       ap_table_setn(e, "LAST_MODIFIED",
  @@ -1023,7 +1021,7 @@
               parse_string(r, tag_val, error, MAX_STRING_LEN, 0);
           }
           else if (!strcmp(tag, "timefmt")) {
  -            ap_time_t *date = r->request_time;
  +            ap_time_t date = r->request_time;
   
               parse_string(r, tag_val, tf, MAX_STRING_LEN, 0);
               ap_table_setn(env, "DATE_LOCAL", ap_ht_time(r->pool, date, tf, 0));
  @@ -1170,7 +1168,6 @@
       char *tag_val;
       struct stat finfo;
       char parsed_string[MAX_STRING_LEN];
  -    ap_time_t *mtime = NULL;
   
       while (1) {
           if (!(tag_val = get_tag(r->pool, in, tag, sizeof(tag), 1))) {
  @@ -1182,8 +1179,9 @@
           else {
               parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0);
               if (!find_file(r, "flastmod", tag, parsed_string, &finfo, error)) {
  -                ap_make_time(&mtime, r->pool);
  -                ap_set_ansitime(mtime, finfo.st_mtime);
  +		ap_time_t mtime;
  +
  +		ap_ansi_time_to_ap_time(&mtime, finfo.st_mtime);
                   ap_rputs(ap_ht_time(r->pool, mtime, tf, 0), r);
               }
           }
  @@ -2346,7 +2344,6 @@
       (enum xbithack *) ap_get_module_config(r->per_dir_config, &includes_module);
       int errstatus;
       request_rec *parent;
  -    ap_time_t *mtime = NULL;
   
       if (!(ap_allow_options(r) & OPT_INCLUDES)) {
           return DECLINED;
  
  
  
  1.13      +34 -28    apache-2.0/src/modules/standard/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_log_config.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- mod_log_config.c	1999/12/30 18:31:29	1.12
  +++ mod_log_config.c	2000/01/09 05:18:31	1.13
  @@ -380,34 +380,46 @@
   
   static const char *log_request_time(request_rec *r, char *a)
   {
  -    int timz;
  -    ap_int32_t mday, year, hour, min, sec, month;
  -    ap_time_t *t;
  +    ap_exploded_time_t xt;
  +    ap_status_t retcode;
       char tstr[MAX_STRING_LEN];
  -    ap_int32_t retcode;
   
  -    ap_make_time(&t, r->pool);
  -    ap_get_gmtoff(&timz, t, r->pool);
  -
  +    /*
  +	hi.  i think getting the time again at the end of the request
  +	just for logging is dumb.  i know it's "required" for CLF.
  +	folks writing log parsing tools don't realise that out of order
  +	times have always been possible (consider what happens if one
  +	process calculates the time to log, but then there's a context
  +	switch before it writes and before that process is run again the
  +	log rotation occurs) and they should just fix their tools rather
  +	than force the server to pay extra cpu cycles.	if you've got
  +	a problem with this, you can set the define.  -djg
  +    */
  +#ifdef I_INSIST_ON_EXTRA_CYCLES_FOR_CLF_COMPLIANCE
  +    ap_explode_localtime(&xt, ap_now());
  +#else
  +    ap_explode_localtime(&xt, r->request_time);
  +#endif
       if (a && *a) {              /* Custom format */
  -        ap_strftime(tstr, &retcode, MAX_STRING_LEN, a, t);
  +        ap_strftime(tstr, &retcode, MAX_STRING_LEN, a, &xt);
       }
       else {                      /* CLF format */
  -        char sign = (timz < 0 ? '-' : '+');
  +	char sign;
  +	int timz;
  +
  +	timz = xt.tm_gmtoff;
  +	if (timz < 0) {
  +	    timz = -timz;
  +	    sign = '-';
  +	}
  +	else {
  +	    sign = '+';
  +	}
   
  -        if (timz < 0) {
  -            timz = -timz;
  -        }
  -        ap_get_mday(t, &mday);
  -        ap_get_year(t, &year);
  -        ap_get_hour(t, &month);
  -        ap_get_hour(t, &hour);
  -        ap_get_min(t, &min);
  -        ap_get_sec(t, &sec);
           ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
  -                mday, ap_month_snames[month], year+1900, 
  -                hour, min, sec,
  -                sign, timz / 60, timz % 60);
  +                xt.tm_mday, ap_month_snames[xt.tm_mon], xt.tm_year+1900,
  +                xt.tm_hour, xt.tm_min, xt.tm_sec,
  +                sign, timz / (60*60), timz % (60*60));
       }
   
       return ap_pstrdup(r->pool, tstr);
  @@ -415,13 +427,7 @@
   
   static const char *log_request_duration(request_rec *r, char *a)
   {
  -    ap_time_t *currtime = NULL;
  -    ap_int32_t diff;
  -    ap_make_time(&currtime, r->pool);
  -    ap_current_time(currtime);
  -
  -    ap_timediff(currtime, r->request_time, &diff); 
  -    return ap_psprintf(r->pool, "%ld", diff);
  +    return ap_psprintf(r->pool, "%ld", (ap_now() - r->request_time) / AP_USEC_PER_SEC);
   }
   
   /* These next two routines use the canonical name:port so that log
  
  
  
  1.11      +22 -45    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- mod_rewrite.c	2000/01/07 20:38:06	1.10
  +++ mod_rewrite.c	2000/01/09 05:18:31	1.11
  @@ -3264,22 +3264,16 @@
   
   static char *current_logtime(request_rec *r)
   {
  -    int timz;
  -    ap_time_t *t;
  +    ap_exploded_time_t t;
       char tstr[80];
  -    char sign;
  -    ap_int32_t len;
  +    ap_size_t len;
   
  -    ap_make_time(&t, r->pool);
  -    ap_get_gmtoff(&timz, t, r->pool);
  -    sign = (timz < 0 ? '-' : '+');
  -    if (timz < 0) {
  -        timz = -timz;
  -    }
  +    ap_explode_localtime(&t, ap_now());
   
  -    ap_strftime(tstr, &len, 80, "[%d/%b/%Y:%H:%M:%S ", t);
  +    ap_strftime(tstr, &len, 80, "[%d/%b/%Y:%H:%M:%S ", &t);
       ap_snprintf(tstr + strlen(tstr), 80-strlen(tstr), "%c%.2d%.2d]",
  -                sign, timz/60, timz%60);
  +                t.tm_gmtoff < 0 ? '-' : '+',
  +		t.tm_gmtoff / (60*60), t.tm_gmtoff % (60*60));
       return ap_pstrdup(r->pool, tstr);
   }
   
  @@ -3556,14 +3550,7 @@
   {
       const char *result;
       char resultbuf[LONG_STRING_LEN];
  -    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;
  +    ap_exploded_time_t tm;
       request_rec *rsub;
   #ifndef WIN32
       struct passwd *pw;
  @@ -3671,51 +3658,41 @@
           result = resultbuf;
       }
   
  +/* XXX: wow this has gotta be slow if you actually use it for a lot, recalculates exploded time for each variable */
       /* underlaying Unix system stuff */
       else if (strcasecmp(var, "TIME_YEAR") == 0) {
  -        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",
  -                    (year / 100) + 19, year % 100);
  +        ap_explode_localtime(&tm, ap_now());
  +        ap_snprintf(resultbuf, sizeof(resultbuf), "%04d", tm.tm_year + 1900);
           result = resultbuf;
       }
   #define MKTIMESTR(format, 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); \
  +    ap_explode_localtime(&tm, ap_now()); \
  +    ap_snprintf(resultbuf, sizeof(resultbuf), format, tm.tmfield); \
       result = resultbuf;
       else if (strcasecmp(var, "TIME_MON") == 0) {
  -        MKTIMESTR("%02d", mon+1)
  +        MKTIMESTR("%02d", tm_mon+1)
       }
       else if (strcasecmp(var, "TIME_DAY") == 0) {
  -        MKTIMESTR("%02d", mday)
  +        MKTIMESTR("%02d", tm_mday)
       }
       else if (strcasecmp(var, "TIME_HOUR") == 0) {
  -        MKTIMESTR("%02d", hour)
  +        MKTIMESTR("%02d", tm_hour)
       }
       else if (strcasecmp(var, "TIME_MIN") == 0) {
  -        MKTIMESTR("%02d", min)
  +        MKTIMESTR("%02d", tm_min)
       }
       else if (strcasecmp(var, "TIME_SEC") == 0) {
  -        MKTIMESTR("%02d", sec)
  +        MKTIMESTR("%02d", tm_sec)
       }
       else if (strcasecmp(var, "TIME_WDAY") == 0) {
  -        MKTIMESTR("%d", wday)
  +        MKTIMESTR("%d", tm_wday)
       }
       else if (strcasecmp(var, "TIME") == 0) {
  -        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_explode_localtime(&tm, ap_now());
           ap_snprintf(resultbuf, sizeof(resultbuf),
  -                    "%02d%02d%02d%02d%02d%02d%02d", (year / 100) + 19,
  -                    (year % 100), mon+1, mday, hour, min, sec);
  +		    "%04d%02d%02d%02d%02d%02d", tm.tm_year + 1900,
  +		    tm.tm_mon+1, tm.tm_mday,
  +		    tm.tm_hour, tm.tm_min, tm.tm_sec);
           result = resultbuf;
           rewritelog(r, 1, "RESULT='%s'", result);
       }
  
  
  
  1.7       +1 -5      apache-2.0/src/modules/standard/mod_status.c
  
  Index: mod_status.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_status.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mod_status.c	1999/12/31 20:32:35	1.6
  +++ mod_status.c	2000/01/09 05:18:31	1.7
  @@ -82,11 +82,7 @@
       int i;
       ap_array_header_t *server_status;
       ap_status_table_row_t *status_rows;
  -    ap_time_t *nowtime = NULL;
   
  -    ap_make_time(&nowtime, r->pool);
  -    ap_current_time(nowtime);
  -
       r->allowed = (1 << M_GET);
       if (r->method_number != M_GET)
   	return DECLINED;
  @@ -110,7 +106,7 @@
       ap_rvputs(r, "Server Built: ",
         ap_get_server_built(), "<br>\n<hr>\n", NULL);
       ap_rvputs(r, "Current Time: ",
  -      ap_ht_time(r->pool, nowtime, DEFAULT_TIME_FORMAT, 0), "<br>\n", NULL);
  +      ap_ht_time(r->pool, ap_now(), DEFAULT_TIME_FORMAT, 0), "<br>\n", NULL);
       ap_rprintf(r, "\n%d connections currently being processed\n",
                  server_status->nelts);
   
  
  
  
  1.10      +13 -70    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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- mod_usertrack.c	2000/01/07 20:38:06	1.9
  +++ mod_usertrack.c	2000/01/09 05:18:31	1.10
  @@ -102,18 +102,13 @@
   #include "httpd.h"
   #include "http_config.h"
   #include "http_core.h"
  -#if !defined(WIN32) && !defined(MPE)
  -#include <sys/time.h>
  -#endif
  -#ifdef HAVE_SYS_TIMES_H
  -#include <sys/times.h>
  -#endif
  +#include "http_request.h"
   
   module MODULE_VAR_EXPORT usertrack_module;
   
   typedef struct {
       int always;
  -    time_t expires;
  +    int expires;
   } cookie_log_state;
   
   typedef struct {
  @@ -121,11 +116,6 @@
       char *cookie_name;
   } cookie_dir_rec;
   
  -/* Define this to allow post-2000 cookies. Cookies use two-digit dates,
  - * so it might be dicey. (Netscape does it correctly, but others may not)
  - */
  -#define MILLENIAL_COOKIES
  -
   /* Make Cookie: Now we have to generate something that is going to be
    * pretty unique.  We can base it on the pid, time, hostip */
   
  @@ -135,13 +125,6 @@
   {
       cookie_log_state *cls = ap_get_module_config(r->server->module_config,
   						 &usertrack_module);
  -#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_TIMES)
  -    clock_t mpe_times;
  -    struct tms mpe_tms;
  -#elif !defined(WIN32)
  -    struct timeval tv;
  -    struct timezone tz = {0, 0};
  -#endif
       /* 1024 == hardcoded constant */
       char cookiebuf[1024];
       char *new_cookie;
  @@ -151,61 +134,21 @@
   
       dcfg = ap_get_module_config(r->per_dir_config, &usertrack_module);
   
  -#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_TIMES)
  -/* We lack gettimeofday(), so we must use time() to obtain the epoch
  -   seconds, and then times() to obtain CPU clock ticks (milliseconds).
  -   Combine this together to obtain a hopefully unique cookie ID. */
  -
  -    mpe_times = times(&mpe_tms);
  -
  -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname,
  -		(int) getpid(),
  -                (long) r->request_time, (long) mpe_tms.tms_utime);
  -#elif defined(WIN32)
  -    /*
  -     * We lack gettimeofday() and we lack times(). So we'll use a combination
  -     * of time() and GetTickCount(), which returns milliseconds since Windows
  -     * was started. It should be relatively unique.
  -     */
  -
  -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%ld", rname,
  -		(int) getpid(),
  -                (long) r->request_time, (long) GetTickCount());
  -
  -#else
  -    gettimeofday(&tv, &tz);
  -
  -    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%d%ld%d", rname,
  -		(int) getpid(),
  -                (long) tv.tv_sec, (int) tv.tv_usec / 1000);
  -#endif
  +    /* XXX: hmm, this should really tie in with mod_unique_id */
  +    ap_snprintf(cookiebuf, sizeof(cookiebuf), "%s.%qd", rname, ap_now());
   
       if (cls->expires) {
  -        ap_time_t *when = NULL;
  -        ap_int64_t req_time;
  -        char *temp_cookie = NULL;
  -        ap_size_t retsize;
  -        
  -        ap_make_time(&when, r->pool);
  -        ap_get_ansitime(when, &req_time);
  -#ifndef MILLENIAL_COOKIES
  -        /*
  -         * Only two-digit date string, so we can't trust "00" or more.
  -         * Therefore, we knock it all back to just before midnight on
  -         * 1/1/2000 (which is 946684799)
  -         */
  -
  -        if (req_time + cls->expires > 946684799) {
  -            ap_set_ansitime(when, 946684799);
  -        }
  -        else
  -#endif
  -            ap_set_ansitime(when,  req_time + cls->expires);
  +	ap_exploded_time_t tms;
  +
  +	ap_explode_gmt(&tms, r->request_time + cls->expires * AP_USEC_PER_SEC);
   
           /* Cookie with date; as strftime '%a, %d-%h-%y %H:%M:%S GMT' */
  -        ap_strftime(temp_cookie, &retsize, MAX_STRING_LEN, "%a, %d-%h-%y %H:%M:%S GMT", when); 
  -        new_cookie = ap_psprintf(r->pool, "%s=%s; path=/; expires=%s", 
  -                                 dcfg->cookie_name, cookiebuf, temp_cookie);
  +        new_cookie = ap_psprintf(r->pool,
  +                "%s=%s; path=/; expires=%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT",
  +                    dcfg->cookie_name, cookiebuf, ap_day_snames[tms.tm_wday],
  +                    tms.tm_mday, ap_month_snames[tms.tm_mon],
  +                    tms.tm_year % 100,
  +                    tms.tm_hour, tms.tm_min, tms.tm_sec);
       }
       else {
   	new_cookie = ap_psprintf(r->pool, "%s=%s; path=/",
  
  
  

Mime
View raw message