diff options
| author | xqyjlj <[email protected]> | 2023-04-22 09:09:40 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-04-22 09:09:40 +0800 |
| commit | fd1413d29bc68e6663f656c12e798300967bbb3f (patch) | |
| tree | d8f054b1d882ac831964099254ac19e4ebf15539 /components/libc/compilers | |
| parent | 06829534e1eb15c906ee4550b21c955302f6585a (diff) | |
🎈 perf(components/libc/compilers/common/ctime.c): if define cputime, then CLOCK_REALTIME use cputime (#7343)
Diffstat (limited to 'components/libc/compilers')
| -rw-r--r-- | components/libc/compilers/common/ctime.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/components/libc/compilers/common/ctime.c b/components/libc/compilers/common/ctime.c index 88f4560d3c..b6d613564b 100644 --- a/components/libc/compilers/common/ctime.c +++ b/components/libc/compilers/common/ctime.c @@ -627,10 +627,11 @@ int clock_getres(clockid_t clockid, struct timespec *res) switch (clockid) { case CLOCK_REALTIME: +#ifndef RT_USING_CPUTIME res->tv_sec = 0; res->tv_nsec = NANOSECOND_PER_SECOND/RT_TICK_PER_SECOND; break; - +#endif #ifdef RT_USING_CPUTIME case CLOCK_CPUTIME_ID: res->tv_sec = 0; @@ -668,6 +669,7 @@ int clock_gettime(clockid_t clockid, struct timespec *tp) switch (clockid) { case CLOCK_REALTIME: +#ifndef RT_USING_CPUTIME { rt_tick_t tick; rt_base_t level; @@ -679,7 +681,7 @@ int clock_gettime(clockid_t clockid, struct timespec *tp) rt_hw_interrupt_enable(level); } break; - +#endif #ifdef RT_USING_CPUTIME case CLOCK_MONOTONIC: case CLOCK_CPUTIME_ID: |
