Skip to content

🎈 perf(components/libc/compilers/common/ctime.c): if … #7343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions components/libc/compilers/common/ctime.c
Original file line number Diff line number Diff line change
@@ -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: