Skip to content

Commit

Permalink
[components] When rtc is not enabled, use other clock sources instead (
Browse files Browse the repository at this point in the history
…#9747)

When rtc is not enabled, use other clock sources instead

Signed-off-by: wycwyhwyq <[email protected]>
  • Loading branch information
wycwyhwyq authored Dec 6, 2024
1 parent 0947a44 commit 6876cb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/libc/compilers/common/ctime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6876cb6

Please sign in to comment.