1/* f77 interface to (f90) cpu_time routine */
2
3#include "f2c.h"
4#include <mach/mach_time.h>
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10#ifdef KR_headers
11 integer
12cpu_time__(t) real *t;
13#else
14 integer
15cpu_time__(real *t)
16#endif
17{
18	static real ratio;
19	static int inited = 0;
20
21	if(!inited) {
22	    struct mach_timebase_info info;
23	    if(mach_timebase_info(&info) != 0) return 1;
24	    ratio = (real)info.numer / ((real)info.denom * NSEC_PER_SEC);
25	    inited++;
26	}
27	*t = ratio * mach_absolute_time();
28	return 0;
29}
30#ifdef __cplusplus
31}
32#endif
33