summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--components/libc/compilers/common/ctime.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c
index b523c827f9..480fe02a54 100644
--- a/components/libc/compilers/common/ctime.c
+++ b/components/libc/compilers/common/ctime.c
@@ -602,9 +602,11 @@ int clock_getres(clockid_t clockid, struct timespec *res)
switch (clockid)
{
+#ifdef RT_USING_RTC
case CLOCK_REALTIME: // use RTC
case CLOCK_REALTIME_COARSE:
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMERES, res);
+#endif /* RT_USING_RTC */
case CLOCK_MONOTONIC: // use cputimer
case CLOCK_MONOTONIC_COARSE:
@@ -633,9 +635,11 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
switch (clockid)
{
+#ifdef RT_USING_RTC
case CLOCK_REALTIME: // use RTC
case CLOCK_REALTIME_COARSE:
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, tp);
+#endif /* RT_USING_RTC */
case CLOCK_MONOTONIC: // use boottime
case CLOCK_MONOTONIC_COARSE:
@@ -675,10 +679,12 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
switch (clockid)
{
+#ifdef RT_USING_RTC
case CLOCK_REALTIME: // use RTC
if (flags & TIMER_ABSTIME)
err = _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, &ts);
break;
+#endif /* RT_USING_RTC */
case CLOCK_MONOTONIC: // use boottime
case CLOCK_PROCESS_CPUTIME_ID:
@@ -727,8 +733,10 @@ int clock_settime(clockid_t clockid, const struct timespec *tp)
switch (clockid)
{
+#ifdef RT_USING_RTC
case CLOCK_REALTIME:
return _control_rtc(RT_DEVICE_CTRL_RTC_SET_TIMESPEC, (void *)tp);
+#endif /* RT_USING_RTC */
case CLOCK_REALTIME_COARSE:
case CLOCK_MONOTONIC: