diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1995-09-04 12:06:20 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1995-09-04 12:06:20 +0000 |
commit | 1e7f2fc591c51f6a9dd21037c700a6a8121fbfae (patch) | |
tree | c605a8e5669e24bb5a0c25c0b4184ecbfa387ecd /otherlibs/unix | |
parent | 65df484b048958ff4498badc7490bb34bf65b7e5 (diff) |
Utiliser CLK_TCK de preference a HZ.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@243 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/unix')
-rw-r--r-- | otherlibs/unix/times.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/otherlibs/unix/times.c b/otherlibs/unix/times.c index 7e16a71f7..f73823124 100644 --- a/otherlibs/unix/times.c +++ b/otherlibs/unix/times.c @@ -15,9 +15,18 @@ #include <alloc.h> #include <memory.h> #include "unix.h" +#include <time.h> #include <sys/types.h> #include <sys/times.h> +#ifndef CLK_TCK +#ifdef HZ +#define CLK_TCK HZ +#else +#define CLK_TCK 60 +#endif +#endif + value unix_times() /* ML */ { value res; @@ -30,10 +39,10 @@ value unix_times() /* ML */ #endif times(&buffer); - t[0] = copy_double((double) buffer.tms_utime / HZ); - t[1] = copy_double((double) buffer.tms_stime / HZ); - t[2] = copy_double((double) buffer.tms_cutime / HZ); - t[3] = copy_double((double) buffer.tms_cstime / HZ); + t[0] = copy_double((double) buffer.tms_utime / CLK_TCK); + t[1] = copy_double((double) buffer.tms_stime / CLK_TCK); + t[2] = copy_double((double) buffer.tms_cutime / CLK_TCK); + t[3] = copy_double((double) buffer.tms_cstime / CLK_TCK); res = alloc_tuple(4); for (i = 0; i < 4; i++) Field(res, i) = t[i]; |