From: Brian Pane Date: Thu, 4 Jul 2002 22:41:48 +0000 (+0000) Subject: replaced APR_USEC_PER_SEC division with the new time macros X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=87ac2481b40f8dc05ddfbd1739a1dc52a9faa2a1;p=apache replaced APR_USEC_PER_SEC division with the new time macros git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95959 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 8d8575db7b..c9cec3f853 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -991,7 +991,7 @@ static void create_listener_thread(thread_starter *ts) * XXX Jeff doesn't see how Apache is going to try to fork again since * the exit code is APEXIT_CHILDFATAL */ - apr_sleep(10 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(10)); clean_child_exit(APEXIT_CHILDFATAL); } apr_os_thread_get(&listener_os_thread, ts->listener); @@ -1072,7 +1072,7 @@ static void * APR_THREAD_FUNC start_threads(apr_thread_t *thd, void *dummy) /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again if we exit. */ - apr_sleep(10 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(10)); clean_child_exit(APEXIT_CHILDFATAL); } threads_created++; @@ -1086,7 +1086,7 @@ static void * APR_THREAD_FUNC start_threads(apr_thread_t *thd, void *dummy) break; } /* wait for previous generation to clean up an entry */ - apr_sleep(1 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(1)); ++loops; if (loops % 120 == 0) { /* every couple of minutes */ if (prev_threads_created == threads_created) { @@ -1138,7 +1138,7 @@ static void join_workers(apr_thread_t *listener, apr_thread_t **threads) #endif == 0) { /* listener not dead yet */ - apr_sleep(APR_USEC_PER_SEC / 2); + apr_sleep(apr_time_make(0, 500000)); wakeup_listener(); ++iter; } @@ -1265,7 +1265,7 @@ static void child_main(int child_num_arg) /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again if we exit. */ - apr_sleep(10 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(10)); clean_child_exit(APEXIT_CHILDFATAL); } @@ -1367,7 +1367,7 @@ static int make_child(server_rec *s, int slot) /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again. */ - apr_sleep(10 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(10)); return -1; } diff --git a/server/util_time.c b/server/util_time.c index 48683a35c8..7b8447f5db 100644 --- a/server/util_time.c +++ b/server/util_time.c @@ -75,7 +75,7 @@ static apr_status_t cached_explode(apr_time_exp_t *xt, apr_time_t t, struct exploded_time_cache_element *cache, int use_gmt) { - apr_int64_t seconds = t / APR_USEC_PER_SEC; + apr_int64_t seconds = apr_time_sec(t); struct exploded_time_cache_element *cache_element = &(cache[seconds % TIME_CACHE_SIZE]); struct exploded_time_cache_element cache_element_snapshot; @@ -157,7 +157,7 @@ static apr_status_t cached_explode(apr_time_exp_t *xt, apr_time_t t, memcpy(&(cache_element->xt), xt, sizeof(apr_time_exp_t)); cache_element->t_validate = seconds; } - xt->tm_usec = (int)(t % APR_USEC_PER_SEC); + xt->tm_usec = (int)apr_time_usec(t); return APR_SUCCESS; }