summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/include
diff options
context:
space:
mode:
authorxqyjlj <[email protected]>2023-07-17 20:11:58 +0800
committerGitHub <[email protected]>2023-07-17 20:11:58 +0800
commit0eb75ced70a514051fcc6a8f1d232e195b15b4a0 (patch)
treea025fe349198fa0fe6f972ea1100ac31ba64787a /components/libc/compilers/common/include
parentb424169e1742c1b19d039f9871dd3c672ea7b729 (diff)
[time]时钟框架重构 (#7794)
Diffstat (limited to 'components/libc/compilers/common/include')
-rw-r--r--components/libc/compilers/common/include/sys/time.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/components/libc/compilers/common/include/sys/time.h b/components/libc/compilers/common/include/sys/time.h
index 8be8d60f29..f1d8585383 100644
--- a/components/libc/compilers/common/include/sys/time.h
+++ b/components/libc/compilers/common/include/sys/time.h
@@ -139,8 +139,12 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#if defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER)
/* POSIX clock and timer */
+#ifndef CLOCK_REALTIME_COARSE
+#define CLOCK_REALTIME_COARSE 0
+#endif /* CLOCK_REALTIME_COARSE */
+
#ifndef CLOCK_REALTIME
-#define CLOCK_REALTIME 1
+#define CLOCK_REALTIME 1
#endif /* CLOCK_REALTIME */
#define CLOCK_CPUTIME_ID 2
@@ -150,13 +154,37 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#endif /* CLOCK_PROCESS_CPUTIME_ID */
#ifndef CLOCK_THREAD_CPUTIME_ID
-#define CLOCK_THREAD_CPUTIME_ID CLOCK_CPUTIME_ID
+#define CLOCK_THREAD_CPUTIME_ID 3
#endif /* CLOCK_THREAD_CPUTIME_ID */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 4
#endif /* CLOCK_MONOTONIC */
+#ifndef CLOCK_MONOTONIC_RAW
+#define CLOCK_MONOTONIC_RAW 5
+#endif /* CLOCK_MONOTONIC_RAW */
+
+#ifndef CLOCK_MONOTONIC_COARSE
+#define CLOCK_MONOTONIC_COARSE 6
+#endif /* CLOCK_MONOTONIC_COARSE */
+
+#ifndef CLOCK_BOOTTIME
+#define CLOCK_BOOTTIME 7
+#endif /* CLOCK_BOOTTIME */
+
+#ifndef CLOCK_REALTIME_ALARM
+#define CLOCK_REALTIME_ALARM 8
+#endif /* CLOCK_REALTIME_ALARM */
+
+#ifndef CLOCK_BOOTTIME_ALARM
+#define CLOCK_BOOTTIME_ALARM 9
+#endif /* CLOCK_BOOTTIME_ALARM */
+
+#ifndef CLOCK_SGI_CYCLE
+#define CLOCK_SGI_CYCLE 10 // newlib says they don't have this definition, make the compiler happy
+#endif /* CLOCK_SGI_CYCLE */
+
#ifndef TIMER_ABSTIME
#define TIMER_ABSTIME 4
#endif /* TIMER_ABSTIME */
@@ -166,6 +194,11 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#else
#define CLOCK_ID_MAX CLOCK_MONOTONIC
#endif
+
+#ifndef CLOCK_TAI
+#define CLOCK_TAI 11 // newlib says they don't have this definition, make the compiler happy
+#endif /* CLOCK_TAI */
+
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK