Debian Codegraph @

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

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