1998-02-01 02:37:08 +01:00
|
|
|
#include "time.h"
|
|
|
|
#ifndef USE_CLOCK
|
1998-05-19 12:52:03 +02:00
|
|
|
#define _INCLUDE_POSIX_SOURCE /* for HP-UX */
|
|
|
|
#define _INCLUDE_XOPEN_SOURCE /* for HP-UX */
|
1998-02-01 02:37:08 +01:00
|
|
|
#include "sys/types.h"
|
|
|
|
#include "sys/times.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#undef Hz
|
|
|
|
#ifdef CLK_TCK
|
|
|
|
#define Hz CLK_TCK
|
|
|
|
#else
|
|
|
|
#ifdef HZ
|
|
|
|
#define Hz HZ
|
|
|
|
#else
|
|
|
|
#define Hz 60
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
double
|
|
|
|
#ifdef KR_headers
|
|
|
|
etime_(tarray) float *tarray;
|
|
|
|
#else
|
|
|
|
etime_(float *tarray)
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
#ifdef USE_CLOCK
|
|
|
|
#ifndef CLOCKS_PER_SECOND
|
|
|
|
#define CLOCKS_PER_SECOND Hz
|
|
|
|
#endif
|
|
|
|
double t = clock();
|
|
|
|
tarray[1] = 0;
|
|
|
|
return tarray[0] = t / CLOCKS_PER_SECOND;
|
|
|
|
#else
|
|
|
|
struct tms t;
|
|
|
|
|
|
|
|
times(&t);
|
|
|
|
return (tarray[0] = t.tms_utime/Hz) + (tarray[1] = t.tms_stime/Hz);
|
|
|
|
#endif
|
|
|
|
}
|