The clock_gettime(2) manual page [1] documents that: > The clock IDs CLOCK_REALTIME_FAST, CLOCK_MONOTONIC_FAST, > CLOCK_UPTIME_FAST are analogs of corresponding IDs without _FAST suffix > but do not perform a full time counter query, so their accuracy is one > timer tick. However, in the source code of kern_clock_gettime() in sys/kern/kern_time.c [2], the clock IDs without a suffix default to PRECISE instead of FAST. Is it the manual page or the source code that needs fixing? [1]: https://www.freebsd.org/cgi/man.cgi?query=clock_gettime&manpath=FreeBSD+13.0-RELEASE+and+Ports [2]: https://cgit.freebsd.org/src/tree/sys/kern/kern_time.c?h=releng%2F13.0#n323
I am not sure what you are really asking, the excerpt you quoted does not say anything about _FAST versions being default, and rather just describes the difference between the _FAST and non-_FAST IDs.
(In reply to Yuri from comment #1) Hmm, the way I read the manual page is that, e.g., CLOCK_REALTIME is just CLOCK_REALTIME_FAST. However, the source code suggests that CLOCK_REALTIME is not CLOCK_REALTIME_FAST but CLOCK_REALTIME_PRECISE instead.
(In reply to Mateusz Piotrowski from comment #2) It says that e.g. CLOCK_REALTIME_FAST is the *analog* of CLOCK_REALTIME, i.e. both return wall clock, but CLOCK_REALTIME_FAST does it in less precise way.
(In reply to Yuri from comment #3) I see, I misunderstood that part. So before I close this ticket, do you think we should mention that CLOCK_REALTIME is currently CLOCK_REALTIME_PRECISE implemented as?
(In reply to Mateusz Piotrowski from comment #4) Clearly there is room for improvement in the man page because someone (i.e., you) found it unclear. Perhaps "analogs" is not the best word to use. That said, I do not think we should document that CLOCK_REALTIME is CLOCK_REALTIME_PRECISE. We should perhaps state something about CLOCK_REALTIME having unspecified fast / precise behaviour. Presumably we chould change the un-suffixed version to a third case that is not exactly _FAST or _PRECISE.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=16e4487e5f82e1ff501fe5af6afbfbd0435a1cbf commit 16e4487e5f82e1ff501fe5af6afbfbd0435a1cbf Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2022-07-08 19:54:10 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2022-07-08 19:57:24 +0000 clock_gettime.2: Clarify CLOCK_* Clarify that CLOCK_* (e.g., CLOCK_REALTIME) do not necessarily default to CLOCK_*_FAST. PR: 259642 lib/libc/sys/clock_gettime.2 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
I simplified the documentation a bit. It is subjectively a bit simpler to understand now.
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=c595a834ebbd4b6fa49b40c8f9cb4e3dda082c4b commit c595a834ebbd4b6fa49b40c8f9cb4e3dda082c4b Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2022-07-08 19:54:10 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-05-13 14:26:10 +0000 clock_gettime.2: Clarify CLOCK_* Clarify that CLOCK_* (e.g., CLOCK_REALTIME) do not necessarily default to CLOCK_*_FAST. PR: 259642 (cherry picked from commit 16e4487e5f82e1ff501fe5af6afbfbd0435a1cbf) lib/libc/sys/clock_gettime.2 | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)