-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
posix: implement clock_getres() #60187
posix: implement clock_getres() #60187
Conversation
Address missing POSIX functions and test zephyrproject-rtos#59955 Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
triggered the PR to rerun the tests
@@ -36,6 +37,12 @@ ZTEST(posix_apis, test_clock) | |||
secs_elapsed = (te.tv_sec - ts.tv_sec - 1); | |||
} | |||
|
|||
ret = clock_getres(CLOCK_MONOTONIC, &te); | |||
zassert_equal(ret, 0, "Fail to get monotonic clock resolution"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can use zassert_ok
to avoid declaring ret
tick_2 = k_uptime_ticks(); | ||
} | ||
|
||
int tick_res = tick_2 - tick_1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tv_nsec
is in long
, this prob can use long
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will need to tie in to specific hardware. Part of the LTSv3 Roadmap is to rework clocks, add device tree chosen nodes for RTC and monotonic, and provide a means of querying the precision of the HW clock resolution.
All of that should be done in Zephyr so that the POSIX layer is just a thin wrapper.
Clock getres should likely come after all of that is done..
Should this be closed, then? |
Probably for now, but I appreciate the effort. |
Address missing POSIX functions and test #59955