summaryrefslogtreecommitdiff
path: root/tests.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-15 16:48:10 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-02-15 16:48:10 -0800
commitbf82e932006e05543e24af49702193a9d8678bfb (patch)
tree29b91cac07b86c44538e90f5ad905435d5359fbf /tests.c
parentd3896c7c307b6f019289890f24cb6b86fe57d58f (diff)
unifdef QNX4
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'tests.c')
-rw-r--r--tests.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/tests.c b/tests.c
index 820212f..a15be2d 100644
--- a/tests.c
+++ b/tests.c
@@ -13,7 +13,7 @@
#ifdef SVR4
#define SYSV
#endif
-#if !defined(SYSV) && !defined(QNX4)
+#if !defined(SYSV)
#include <sys/resource.h>
#endif
@@ -42,10 +42,8 @@ timer(int flag)
#if !defined(SYSV)
static struct timeval starttime; /* starting time for gettimeofday() */
struct timeval endtime; /* ending time for gettimeofday() */
-#if !defined(QNX4)
static struct rusage startusage; /* starting time for getrusage() */
struct rusage endusage; /* ending time for getrusage() */
-#endif
struct timezone tz; /* to make gettimeofday() happy */
long elapsedtime; /* how long since we started the timer */
@@ -53,21 +51,16 @@ timer(int flag)
switch (flag) {
case StartTimer: /* store initial values */
gettimeofday(&starttime,&tz);
-#if !defined(QNX4)
getrusage(RUSAGE_SELF,&startusage);
-#endif
return((long) NULL);
case EndTimer:
gettimeofday(&endtime,&tz); /* store final values */
-#if !defined(QNX4)
getrusage(RUSAGE_SELF,&endusage);
-#endif
/* all the following line does is use the formula
elapsed time = ending time - starting time, but there are three
different timers and two different units of time, ack... */
-#if !defined(QNX4)
elapsedtime = (long) ((long)
((endtime.tv_sec - endusage.ru_utime.tv_sec - endusage.ru_stime.tv_sec
- starttime.tv_sec + startusage.ru_utime.tv_sec
@@ -75,10 +68,7 @@ timer(int flag)
((endtime.tv_usec - endusage.ru_utime.tv_usec - endusage.ru_stime.tv_usec
- starttime.tv_usec + startusage.ru_utime.tv_usec
+ startusage.ru_stime.tv_usec));
-#else
- elapsedtime = (long)( ((long)endtime.tv_sec-(long)starttime.tv_sec)*1000000
- +((long)endtime.tv_usec-(long)starttime.tv_usec));
-#endif
+
return(elapsedtime);
default: