Skip to content
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

Closed

Conversation

harshilbhatt2001
Copy link
Contributor

Address missing POSIX functions and test #59955

Address missing POSIX functions and test zephyrproject-rtos#59955

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
@harshilbhatt2001 harshilbhatt2001 requested a review from cfriedt as a code owner July 9, 2023 22:03
@zephyrbot zephyrbot added the area: POSIX POSIX API Library label Jul 9, 2023
@carlescufi carlescufi requested a review from ycsin July 10, 2023 07:33
@ycsin ycsin closed this Jul 10, 2023
@ycsin ycsin reopened this Jul 10, 2023
@ycsin ycsin linked an issue Jul 10, 2023 that may be closed by this pull request
Copy link
Member

@ycsin ycsin left a 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");
Copy link
Member

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;
Copy link
Member

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?

Copy link
Member

@cfriedt cfriedt left a 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..

@harshilbhatt2001
Copy link
Contributor Author

Should this be closed, then?

@cfriedt
Copy link
Member

cfriedt commented Jul 10, 2023

Probably for now, but I appreciate the effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

posix: implement clock_getres()
4 participants