瀏覽代碼

[pthreads] Add CLOCK_CPUTIME_ID/CLOCK_MONOTONIC clock_id

Bernard Xiong 7 年之前
父節點
當前提交
e1da54e513
共有 1 個文件被更改,包括 14 次插入1 次删除
  1. 14 1
      components/libc/pthreads/pthread.h

+ 14 - 1
components/libc/pthreads/pthread.h

@@ -307,7 +307,20 @@ struct sigevent
 #define NANOSECOND_PER_TICK     (NANOSECOND_PER_SECOND  / RT_TICK_PER_SECOND)
 
 #ifndef CLOCK_REALTIME
-#define CLOCK_REALTIME      0
+#define CLOCK_REALTIME      1
+#endif
+
+#define CLOCK_CPUTIME_ID    2
+
+#ifndef CLOCK_PROCESS_CPUTIME_ID
+#define CLOCK_PROCESS_CPUTIME_ID CLOCK_CPUTIME_ID
+#endif
+#ifndef CLOCK_THREAD_CPUTIME_ID
+#define CLOCK_THREAD_CPUTIME_ID  CLOCK_CPUTIME_ID
+#endif
+
+#ifndef CLOCK_MONOTONIC
+#define CLOCK_MONOTONIC     4
 #endif
 
 int clock_getres  (clockid_t clockid, struct timespec *res);