21 |
|
#else |
22 |
|
#include <sys/times.h> |
23 |
|
#include <sys/utsname.h> |
24 |
< |
#include <limits.h> |
24 |
> |
#include <unistd.h> |
25 |
|
#endif |
26 |
|
#endif |
27 |
|
|
140 |
|
#else |
141 |
|
struct tms tbuf; |
142 |
|
struct utsname nambuf; |
143 |
+ |
double period; |
144 |
|
#define hostname nambuf.sysname |
145 |
|
#endif |
146 |
|
|
155 |
|
gethostname(hostname, sizeof(hostname)); |
156 |
|
#else |
157 |
|
times(&tbuf); |
158 |
< |
u = ( tbuf.tms_utime + tbuf.tms_cutime ) / CLK_TCK; |
159 |
< |
s = ( tbuf.tms_stime + tbuf.tms_cstime ) / CLK_TCK; |
158 |
> |
period = 1.0 / sysconf(_SC_CLK_TCK); |
159 |
> |
u = ( tbuf.tms_utime + tbuf.tms_cutime ) * period; |
160 |
> |
s = ( tbuf.tms_stime + tbuf.tms_cstime ) * period; |
161 |
|
uname(&nambuf); |
162 |
|
#endif |
163 |
|
|