brianp 2002/07/04 17:11:11
Modified: test client.c testflock.c testlock.c testmutexscope.c
testoc.c testpipe.c testshm.c testshmconsumer.c
testsleep.c
Log:
use new time conversion macros in place of APR_USEC_PER_SEC
Revision Changes Path
1.35 +1 -1 apr/test/client.c
Index: client.c
===================================================================
RCS file: /home/cvs/apr/test/client.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- client.c 13 Mar 2002 20:39:27 -0000 1.34
+++ client.c 5 Jul 2002 00:11:10 -0000 1.35
@@ -72,7 +72,7 @@
char *local_ipaddr, *remote_ipaddr;
char *dest = "127.0.0.1";
apr_port_t local_port, remote_port;
- apr_interval_time_t timeout = 2 * APR_USEC_PER_SEC;
+ apr_interval_time_t timeout = apr_time_from_sec(2);
apr_sockaddr_t *local_sa, *remote_sa;
setbuf(stdout, NULL);
1.11 +1 -1 apr/test/testflock.c
Index: testflock.c
===================================================================
RCS file: /home/cvs/apr/test/testflock.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- testflock.c 13 Mar 2002 20:39:27 -0000 1.10
+++ testflock.c 5 Jul 2002 00:11:10 -0000 1.11
@@ -147,7 +147,7 @@
printf("Lock created.\nSleeping...");
fflush(stdout);
- apr_sleep(30 * APR_USEC_PER_SEC);
+ apr_sleep(apr_time_from_sec(30));
(void) apr_file_close(file);
printf(" done.\nExiting.\n");
1.20 +1 -1 apr/test/testlock.c
Index: testlock.c
===================================================================
RCS file: /home/cvs/apr/test/testlock.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- testlock.c 11 Apr 2002 22:55:41 -0000 1.19
+++ testlock.c 5 Jul 2002 00:11:10 -0000 1.20
@@ -395,7 +395,7 @@
}
printf("OK\n");
- timeout = 5 * APR_USEC_PER_SEC;
+ timeout = apr_time_from_sec(5);
for (i = 0; i < MAX_RETRY; i++) {
apr_thread_mutex_lock(timeout_mutex);
1.3 +1 -1 apr/test/testmutexscope.c
Index: testmutexscope.c
===================================================================
RCS file: /home/cvs/apr/test/testmutexscope.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- testmutexscope.c 13 May 2002 16:36:23 -0000 1.2
+++ testmutexscope.c 5 Jul 2002 00:11:10 -0000 1.3
@@ -174,7 +174,7 @@
++i;
}
- apr_sleep(5 * APR_USEC_PER_SEC);
+ apr_sleep(apr_time_from_sec(5));
if (test_mode == TEST_PROC) {
printf(" Mutex mechanism `%s' is %sglobal in scope on this
platform.\n",
1.24 +2 -2 apr/test/testoc.c
Index: testoc.c
===================================================================
RCS file: /home/cvs/apr/test/testoc.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- testoc.c 13 Mar 2002 20:39:27 -0000 1.23
+++ testoc.c 5 Jul 2002 00:11:10 -0000 1.24
@@ -143,7 +143,7 @@
fprintf(stdout, "[PARENT] Sending SIGKILL to child......");
fflush(stdout);
- apr_sleep(1 * APR_USEC_PER_SEC);
+ apr_sleep(apr_time_from_sec(1));
if ((rv = apr_proc_kill(&newproc, SIGKILL)) != APR_SUCCESS) {
char msgbuf[120];
@@ -154,7 +154,7 @@
fprintf(stdout,"OK\n");
/* allow time for things to settle... */
- apr_sleep(3 * APR_USEC_PER_SEC);
+ apr_sleep(apr_time_from_sec(3));
fprintf(stdout, "[PARENT] Checking on children..........\n");
apr_proc_other_child_check();
1.19 +1 -1 apr/test/testpipe.c
Index: testpipe.c
===================================================================
RCS file: /home/cvs/apr/test/testpipe.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- testpipe.c 13 Mar 2002 20:39:27 -0000 1.18
+++ testpipe.c 5 Jul 2002 00:11:10 -0000 1.19
@@ -95,7 +95,7 @@
}
fprintf(stdout, "\tSetting pipe timeout.......");
- if ((rv = apr_file_pipe_timeout_set(readp, 1 * APR_USEC_PER_SEC)) !=
APR_SUCCESS) {
+ if ((rv = apr_file_pipe_timeout_set(readp, apr_time_from_sec(1))) !=
APR_SUCCESS) {
fprintf(stderr, "apr_file_pipe_timeout_set()->%d/%s\n",
rv, apr_strerror(rv, msgbuf, sizeof msgbuf));
exit(-1);
1.7 +4 -3 apr/test/testshm.c
Index: testshm.c
===================================================================
RCS file: /home/cvs/apr/test/testshm.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- testshm.c 27 Mar 2002 20:51:52 -0000 1.6
+++ testshm.c 5 Jul 2002 00:11:10 -0000 1.7
@@ -82,7 +82,8 @@
{
int i;
apr_time_t start = apr_time_now();
- while (apr_time_now() - start < sleep_sec * APR_USEC_PER_SEC) {
+ apr_interval_time_t sleep_duration = apr_time_from_sec(sleep_sec);
+ while (apr_time_now() - start < sleep_duration) {
for (i = first_box; i < last_box; i++) {
if (boxes[i].msgavail) {
fprintf(stdout, "received a message in box %d, message was:
%s\n",
@@ -90,7 +91,7 @@
boxes[i].msgavail = 0; /* reset back to 0 */
}
}
- apr_sleep(1*APR_USEC_PER_SEC/100);
+ apr_sleep(apr_time_make(0, 10000)); /* 10ms */
}
fprintf(stdout, "done waiting on mailboxes...\n");
}
@@ -157,7 +158,7 @@
i += N_BOXES; /* start over at the top */
}
msgput(i, "Sending a message\n");
- apr_sleep(1*APR_USEC_PER_SEC/100);
+ apr_sleep(apr_time_make(0, 10000));
}
}
else {
1.5 +3 -2 apr/test/testshmconsumer.c
Index: testshmconsumer.c
===================================================================
RCS file: /home/cvs/apr/test/testshmconsumer.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- testshmconsumer.c 13 Mar 2002 20:39:27 -0000 1.4
+++ testshmconsumer.c 5 Jul 2002 00:11:11 -0000 1.5
@@ -81,7 +81,8 @@
{
int i;
apr_time_t start = apr_time_now();
- while (apr_time_now() - start < sleep_sec * APR_USEC_PER_SEC) {
+ apr_interval_time_t sleep_duration = apr_time_from_sec(sleep_sec);
+ while (apr_time_now() - start < sleep_duration) {
for (i = first_box; i < last_box; i++) {
if (boxes[i].msgavail) {
fprintf(stdout, "Consumer: received a message in box %d,
message was: %s\n",
@@ -89,7 +90,7 @@
boxes[i].msgavail = 0; /* reset back to 0 */
}
}
- apr_sleep(1*APR_USEC_PER_SEC);
+ apr_sleep(apr_time_from_sec(1));
}
fprintf(stdout, "Consumer: done waiting on mailboxes...\n");
}
1.8 +1 -1 apr/test/testsleep.c
Index: testsleep.c
===================================================================
RCS file: /home/cvs/apr/test/testsleep.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- testsleep.c 13 Mar 2002 20:39:27 -0000 1.7
+++ testsleep.c 5 Jul 2002 00:11:11 -0000 1.8
@@ -66,7 +66,7 @@
static void do_sleep(int howlong)
{
apr_time_t then, now, diff;
- apr_time_t interval = howlong * APR_USEC_PER_SEC;
+ apr_time_t interval = apr_time_from_sec(howlong);
printf(" I'm about to go to sleep!\n");