rbb 00/01/06 12:20:30
Modified: src/lib/apr/include apr_time.h src/lib/apr/time/unix time.c Log: Add a new time function which creates a new time instance and initializes the current time. This augments the ap_make_time ap_current_time combination that we already have because it does the same thing in one function. Both methods are necessary, because more often than not, we create a time instance, but don't fill it out with the current time. Revision Changes Path 1.10 +1 -0 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.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- apr_time.h 2000/01/06 19:19:26 1.9 +++ apr_time.h 2000/01/06 20:20:21 1.10 @@ -76,6 +76,7 @@ /* 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 *); 1.15 +22 -1 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.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- time.c 1999/12/21 15:16:36 1.14 +++ time.c 2000/01/06 20:20:25 1.15 @@ -58,7 +58,7 @@ /* ***APRDOC******************************************************** * ap_status_t ap_make_time(ap_context_t *, ap_time_t *) - * Create a time entity. + * Create an empty time entity. * arg 1) The context to operate on. * arg 2) The new time entity to create. */ @@ -74,6 +74,27 @@ (*new)->explodedtime = ap_palloc(cont, sizeof(struct tm)); (*new)->time_ex = 0; (*new)->currtime = NULL; + 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_status_t ap_make_init_time(struct atime_t **new, ap_context_t *cont) +{ + (*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; + gettimeofday((*new)->currtime, NULL); return APR_SUCCESS; }