OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / libf2c / libF77 / dtime_.c
1 #include "time.h"
2 #ifndef USE_CLOCK
3 #define _INCLUDE_POSIX_SOURCE   /* for HP-UX */
4 #define _INCLUDE_XOPEN_SOURCE   /* for HP-UX */
5 #include "sys/types.h"
6 #include "sys/times.h"
7 #endif
8
9 #undef Hz
10 #ifdef CLK_TCK
11 #define Hz CLK_TCK
12 #else
13 #ifdef HZ
14 #define Hz HZ
15 #else
16 #define Hz 60
17 #endif
18 #endif
19
20  double
21 #ifdef KR_headers
22 dtime_(tarray) float *tarray;
23 #else
24 dtime_(float *tarray)
25 #endif
26 {
27 #ifdef USE_CLOCK
28 #ifndef CLOCKS_PER_SECOND
29 #define CLOCKS_PER_SECOND Hz
30 #endif
31         static double t0;
32         double t = clock();
33         tarray[1] = 0;
34         tarray[0] = (t - t0) / CLOCKS_PER_SECOND;
35         t0 = t;
36         return tarray[0];
37 #else
38         struct tms t;
39         static struct tms t0;
40
41         times(&t);
42         tarray[0] = (t.tms_utime - t0.tms_utime) / Hz;
43         tarray[1] = (t.tms_stime - t0.tms_stime) / Hz;
44         t0 = t;
45         return tarray[0] + tarray[1];
46 #endif
47         }