From: dps@micro-mono.com ("Daniel P. Siu")
Subject: time functions
4 Jun 1997 21:06:23 -0700
Sender: mail@cygnus.com
Approved: cygnus.gnu-win32@cygnus.com
Distribution: cygnus
Message-ID: <3395F505.39B9.cygnus.gnu-win32@micro-mono.com>
Reply-To: dps@micro-mono.com
X-Mailer: Mozilla 3.01Gold (Win95; U)
MIME-Version: 1.0
Original-To: gnu-win32@cygnus.com
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Original-Sender: owner-gnu-win32@cygnus.com

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:dps@micro-mono.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
