[time]时钟框架重构 (#7794)

This commit is contained in:
xqyjlj
2023-07-17 20:11:58 +08:00
committed by GitHub
parent b424169e17
commit 0eb75ced70
23 changed files with 1170 additions and 602 deletions

View File

@@ -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