Subject: time functions
From: [email-masked] ("Daniel P. Siu")

4 Jun 1997 21:06:23 -0700
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Reply-To: [email-masked]
X-Mailer: Mozilla 3.01Gold (Win95; U)
MIME-Version: 1.0
Original-To: [email-masked]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Original-Sender: [email-masked]

I just got started with gnu-win32 (w95).  I encountered strange results
with the 'times' library function (I know, this is obsolete but I also
encountered strange though different results with the 'getrusage' system
call).  'times' calls return should return number of 'CLK_TCK' since
invocation of the current process.  Instead it returns very big numbers
(millions).

The following routine is taken from an old Berkeley f77 distribution:

#include <sys/types.h>
#include <sys/times.h>
#include <time.h>

struct tb { float usrtime; float systime; };

float
etime_(et) struct tb *et;
{	struct tms clock;

	times(&clock);
	et->usrtime = (float) clock.tms_utime / (float)CLK_TCK;
	et->systime = (float) clock.tms_stime / (float)CLK_TCK;
	return(et->usrtime + et->systime);
}

This works fine under f2c or g77 and many Unix systems including Linux
and Solaris but gives strange under g77 and gnu-win32.

Thanks in advance.

-- 
Daniel P. Siu
Microwave Monolithics Incorporated
465 E. Easy Street, Simi Valley, CA 93065, USA
VOICE:805-584-6642 FAX:805-584-9594 EMAIL:[email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".