Skip to content

Commit 6876cb6

Browse files
authored
[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]>
1 parent 0947a44 commit 6876cb6

File tree

1 file changed

+3
-3
lines changed
  • components/libc/compilers/common

1 file changed

+3
-3
lines changed

components/libc/compilers/common/ctime.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,9 +602,9 @@ int clock_getres(clockid_t clockid, struct timespec *res)
602602

603603
switch (clockid)
604604
{
605-
#ifdef RT_USING_RTC
606605
case CLOCK_REALTIME: // use RTC
607606
case CLOCK_REALTIME_COARSE:
607+
#ifdef RT_USING_RTC
608608
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMERES, res);
609609
#endif /* RT_USING_RTC */
610610

@@ -635,9 +635,9 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
635635

636636
switch (clockid)
637637
{
638-
#ifdef RT_USING_RTC
639638
case CLOCK_REALTIME: // use RTC
640639
case CLOCK_REALTIME_COARSE:
640+
#ifdef RT_USING_RTC
641641
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, tp);
642642
#endif /* RT_USING_RTC */
643643

@@ -679,8 +679,8 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
679679

680680
switch (clockid)
681681
{
682-
#ifdef RT_USING_RTC
683682
case CLOCK_REALTIME: // use RTC
683+
#ifdef RT_USING_RTC
684684
if (flags & TIMER_ABSTIME)
685685
err = _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, &ts);
686686
break;

0 commit comments

Comments
 (0)