Commits

Brandon Mitchell  committed b514ca7

Portable clock modes.

  • Participants
  • Parent commits ae6e304
  • Branches freebsd

Comments (0)

Files changed (1)

File base/core/lib/unix_stubs.c

   return caml_copy_nativeint(c);
 }
 
+#if defined(CLOCK_PROCESS_CPUTIME_ID)
+#define CLOCK CLOCK_PROCESS_CPUTIME_ID
+#elif defined(CLOCK_PROF)
+#define CLOCK CLOCK_PROF
+#else
+#define CLOCK CLOCK_REALTIME
+#endif
+
 CAMLprim value unix_clock_process_cputime_id_stub(value __unused v_unit)
 {
-  return caml_copy_nativeint(CLOCK_PROCESS_CPUTIME_ID);
+  return caml_copy_nativeint(CLOCK);
 }
 
 CAMLprim value unix_clock_thread_cputime_id_stub(value __unused v_unit)
 {
-  return caml_copy_nativeint(CLOCK_THREAD_CPUTIME_ID);
+  return caml_copy_nativeint(CLOCK);
 }
 
 /* Clock functions */