Debian Codegraph @

debian/external_deps/fetk/punc/src/vf2c/etime_.c

raw
1 #include "time.h"
2
3 #if defined MSDOS || defined _WIN32
4 #undef USE_CLOCK
5 #define USE_CLOCK
6 #endif
7
8 #ifndef REAL
9 #define REAL double
10 #endif
11
12 #ifndef USE_CLOCK
13 #define _INCLUDE_POSIX_SOURCE /* for HP-UX */
14 #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */
15 #include "sys/types.h"
16 #include "sys/times.h"
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 #endif
21
22 #undef Hz
23 #ifdef CLK_TCK
24 #define Hz CLK_TCK
25 #else
26 #ifdef HZ
27 #define Hz HZ
28 #else
29 #define Hz 60
30 #endif
31 #endif
32
33 REAL
34 #ifdef KR_headers
35 etime_(tarray) float *tarray;
36 #else
37 etime_(float *tarray)
38 #endif
39 {
40 #ifdef USE_CLOCK
41 #ifndef CLOCKS_PER_SECOND
42 #define CLOCKS_PER_SECOND Hz
43 #endif
44 double t = clock();
45 tarray[1] = 0;
46 return tarray[0] = t / CLOCKS_PER_SECOND;
47 #else
48 struct tms t;
49
50 times(&t);
51 return (tarray[0] = (double)t.tms_utime/Hz)
52 + (tarray[1] = (double)t.tms_stime/Hz);
53 #endif
54 }
55 #ifdef __cplusplus
56 }
57 #endif