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() #59955

Closed
Tracked by #51211
ycsin opened this issue Jul 3, 2023 · 0 comments · Fixed by #70525
Closed
Tracked by #51211

posix: implement clock_getres() #59955

ycsin opened this issue Jul 3, 2023 · 0 comments · Fixed by #70525
Assignees
Labels
area: POSIX POSIX API Library Enhancement Changes/Updates/Additions to existing features Good first issue Good for a first time contributor to take

Comments

@ycsin
Copy link
Member

ycsin commented Jul 3, 2023

Blocked for now, see: #60187 (review)

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..

There are currently 20 missing POSIX functions with trivial implementations, clock_getres() is one of them.

clock_getres, clock_gettime, clock_settime - clock and timer functions

The clock_getres() function shall return the resolution of any clock. Clock resolutions are implementation-defined and cannot be set by a process. If the argument res is not NULL, the resolution of the specified clock shall be stored in the location pointed to by res. If res is NULL, the clock resolution is not returned. If the time argument of clock_settime() is not a multiple of res, then the value is truncated to a multiple of res.

The clock_gettime() function shall return the current value tp for the specified clock, clock_id.

The clock_settime() function shall set the specified clock, clock_id, to the value specified by tp. Time values that are between two consecutive non-negative integer multiples of the resolution of the specified clock shall be truncated down to the smaller multiple of the resolution.
...

See https://pubs.opengroup.org/onlinepubs/9699919799/functions/clock_getres.html

See RFC #51211 for more info.

@ycsin ycsin added Feature Request A request for a new feature Good first issue Good for a first time contributor to take area: POSIX POSIX API Library labels Jul 3, 2023
@ycsin ycsin moved this to v3.5 in Release Plan Jul 3, 2023
@ycsin ycsin moved this from v3.5 to LTS3 Goals in Release Plan Jul 3, 2023
@ycsin ycsin added this to the v3.5.0 milestone Jul 3, 2023
@cfriedt cfriedt assigned cfriedt and unassigned cfriedt Jul 4, 2023
harshilbhatt2001 added a commit to harshilbhatt2001/zephyr that referenced this issue Jul 9, 2023
Address missing POSIX functions and test zephyrproject-rtos#59955

Signed-off-by: Harshil Bhatt <harshilbhatt2001@gmail.com>
@ycsin ycsin linked a pull request Jul 10, 2023 that will close this issue
@cfriedt cfriedt removed the status in Release Plan Sep 12, 2023
@nashif nashif removed this from Release Plan Sep 13, 2023
@cfriedt cfriedt removed this from the v3.5.0 milestone Oct 13, 2023
@nashif nashif added Enhancement Changes/Updates/Additions to existing features and removed Feature Request A request for a new feature labels Jan 19, 2024
@cfriedt cfriedt closed this as completed Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: POSIX POSIX API Library Enhancement Changes/Updates/Additions to existing features Good first issue Good for a first time contributor to take
Projects
None yet
3 participants