Skip to content

Commit fd1413d

Browse files
authored
🎈 perf(components/libc/compilers/common/ctime.c): if define cputime, then CLOCK_REALTIME use cputime (#7343)
1 parent 0682953 commit fd1413d

File tree

1 file changed

+4
-2
lines changed
  • components/libc/compilers/common

1 file changed

+4
-2
lines changed

‎components/libc/compilers/common/ctime.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,11 @@ int clock_getres(clockid_t clockid, struct timespec *res)
627627
switch (clockid)
628628
{
629629
case CLOCK_REALTIME:
630+
#ifndef RT_USING_CPUTIME
630631
res->tv_sec = 0;
631632
res->tv_nsec = NANOSECOND_PER_SECOND/RT_TICK_PER_SECOND;
632633
break;
633-
634+
#endif
634635
#ifdef RT_USING_CPUTIME
635636
case CLOCK_CPUTIME_ID:
636637
res->tv_sec = 0;
@@ -668,6 +669,7 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
668669
switch (clockid)
669670
{
670671
case CLOCK_REALTIME:
672+
#ifndef RT_USING_CPUTIME
671673
{
672674
rt_tick_t tick;
673675
rt_base_t level;
@@ -679,7 +681,7 @@ int clock_gettime(clockid_t clockid, struct timespec *tp)
679681
rt_hw_interrupt_enable(level);
680682
}
681683
break;
682-
684+
#endif
683685
#ifdef RT_USING_CPUTIME
684686
case CLOCK_MONOTONIC:
685687
case CLOCK_CPUTIME_ID:

0 commit comments

Comments
 (0)