From bf82e932006e05543e24af49702193a9d8678bfb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 15 Feb 2024 16:48:10 -0800 Subject: unifdef QNX4 Signed-off-by: Alan Coopersmith --- tests.c | 14 ++------------ 1 file 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 #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: -- cgit v1.2.3