This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

time functions


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".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]