From 65fe92eb203e9d04f482cebc814d4bbce811337b Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Thu, 4 Jul 2002 22:56:51 +0000 Subject: [PATCH] use the time conversion macros rather than dividing by APR_USEC_PER_SEC git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95960 13f79535-47bb-0310-9956-ffa450edef68 --- support/ab.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/support/ab.c b/support/ab.c index d19a008a54..c0bbef2df3 100644 --- a/support/ab.c +++ b/support/ab.c @@ -301,7 +301,7 @@ char *csvperc; /* CSV Percentile file */ char url[1024]; char * fullurl, * colonhost; int isproxy = 0; -apr_short_interval_time_t aprtimeout = 30 * APR_USEC_PER_SEC; /* timeout value */ +apr_interval_time_t aprtimeout = apr_time_from_sec(30); /* timeout value */ /* * XXX - this is now a per read/write transact type of value */ @@ -658,7 +658,7 @@ void ssl_start_connect(struct connection * c) case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_CONNECT: BIO_printf(bio_err, "Waiting .. sleep(1)\n"); - apr_sleep(1 * APR_USEC_PER_SEC); + apr_sleep(apr_time_from_sec(1)); c->state = STATE_CONNECTING; c->rwrite = 0; break; @@ -827,7 +827,8 @@ static void output_results(void) endtime = apr_time_now(); timetakenusec = endtime - start; - timetaken = (float) timetakenusec / APR_USEC_PER_SEC; + timetaken = ((float)apr_time_sec(timetakenusec)) + + ((float)apr_time_usec(timetakenusec)) / 1000000.0; printf("\n\n"); printf("Server Software: %s\n", servername); @@ -839,8 +840,8 @@ static void output_results(void) printf("\n"); printf("Concurrency Level: %d\n", concurrency); printf("Time taken for tests: %ld.%03ld seconds\n", - (long) (timetakenusec / APR_USEC_PER_SEC), - (long) (timetakenusec % APR_USEC_PER_SEC)); + (long) apr_time_sec(timetakenusec), + (long) apr_time_usec(timetakenusec)); printf("Complete requests: %ld\n", done); printf("Failed requests: %ld\n", bad); if (bad) @@ -1100,7 +1101,8 @@ static void output_html_results(void) trstring, tdstring, tdstring, concurrency); printf("Time taken for tests:" "%qd.%03qd seconds\n", - trstring, tdstring, tdstring, timetaken / APR_USEC_PER_SEC, timetaken % APR_USEC_PER_SEC); + trstring, tdstring, tdstring, (long long)apr_time_sec(timetaken), + (long long)apr_time_usec(timetaken)); printf("Complete requests:" "%ld\n", trstring, tdstring, tdstring, done); @@ -1635,7 +1637,7 @@ static void test(void) /* check for time limit expiry */ now = apr_time_now(); - timed = (apr_int32_t)((now - start) / APR_USEC_PER_SEC); + timed = (apr_int32_t)apr_time_sec(now - start); if (tlimit && timed > (tlimit * 1000)) { requests = done; /* so stats are correct */ } @@ -1723,14 +1725,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.105 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.106 $> apache-2.0"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.105 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.106 $"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
\n"); printf("

\n

\n"); -- 2.40.0