Skip to content

Commit

Permalink
Utiliser CLK_TCK de preference a HZ.
Browse files Browse the repository at this point in the history
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@243 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
  • Loading branch information
xavierleroy committed Sep 4, 1995
1 parent 65df484 commit 1e7f2fc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions otherlibs/unix/times.c
Expand Up @@ -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;
Expand All @@ -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];
Expand Down

0 comments on commit 1e7f2fc

Please sign in to comment.