diff options
| author | wycwyhwyq <[email protected]> | 2024-12-06 20:13:03 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-12-06 20:13:03 +0800 |
| commit | 6876cb6f7361fd6bc754a1dc15ced54c770f005d (patch) | |
| tree | efe810db51ecf8ec73638a999783849da5d7ab15 | |
| parent | 0947a446582e17694255aff31542aaa1145af2c4 (diff) | |
[components] When rtc is not enabled, use other clock sources instead (#9747)
When rtc is not enabled, use other clock sources instead
Signed-off-by: wycwyhwyq <[email protected]>
| -rw-r--r-- | components/libc/compilers/common/ctime.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 7c236f3da8..7910356704 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -602,9 +602,9 @@ int clock_getres(clockid_t clockid, struct timespec *res) switch (clockid) { -#ifdef RT_USING_RTC case CLOCK_REALTIME: // use RTC case CLOCK_REALTIME_COARSE: +#ifdef RT_USING_RTC return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMERES, res); #endif /* RT_USING_RTC */ @@ -635,9 +635,9 @@ int clock_gettime(clockid_t clockid, struct timespec *tp) switch (clockid) { -#ifdef RT_USING_RTC case CLOCK_REALTIME: // use RTC case CLOCK_REALTIME_COARSE: +#ifdef RT_USING_RTC return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, tp); #endif /* RT_USING_RTC */ @@ -679,8 +679,8 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s switch (clockid) { -#ifdef RT_USING_RTC case CLOCK_REALTIME: // use RTC +#ifdef RT_USING_RTC if (flags & TIMER_ABSTIME) err = _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, &ts); break; |
