mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-19 20:43:43 +08:00
[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 <5f20.6d9b@gmail.com>
This commit is contained in:
@@ -602,9 +602,9 @@ int clock_getres(clockid_t clockid, struct timespec *res)
|
|||||||
|
|
||||||
switch (clockid)
|
switch (clockid)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_RTC
|
|
||||||
case CLOCK_REALTIME: // use RTC
|
case CLOCK_REALTIME: // use RTC
|
||||||
case CLOCK_REALTIME_COARSE:
|
case CLOCK_REALTIME_COARSE:
|
||||||
|
#ifdef RT_USING_RTC
|
||||||
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMERES, res);
|
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMERES, res);
|
||||||
#endif /* RT_USING_RTC */
|
#endif /* RT_USING_RTC */
|
||||||
|
|
||||||
@@ -635,9 +635,9 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
|
|||||||
|
|
||||||
switch (clockid)
|
switch (clockid)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_RTC
|
|
||||||
case CLOCK_REALTIME: // use RTC
|
case CLOCK_REALTIME: // use RTC
|
||||||
case CLOCK_REALTIME_COARSE:
|
case CLOCK_REALTIME_COARSE:
|
||||||
|
#ifdef RT_USING_RTC
|
||||||
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, tp);
|
return _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, tp);
|
||||||
#endif /* RT_USING_RTC */
|
#endif /* RT_USING_RTC */
|
||||||
|
|
||||||
@@ -679,8 +679,8 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *rqtp, s
|
|||||||
|
|
||||||
switch (clockid)
|
switch (clockid)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_RTC
|
|
||||||
case CLOCK_REALTIME: // use RTC
|
case CLOCK_REALTIME: // use RTC
|
||||||
|
#ifdef RT_USING_RTC
|
||||||
if (flags & TIMER_ABSTIME)
|
if (flags & TIMER_ABSTIME)
|
||||||
err = _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, &ts);
|
err = _control_rtc(RT_DEVICE_CTRL_RTC_GET_TIMESPEC, &ts);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user