git: 560f38cec2f7 - stable/15 - kern_time: Honor the precise option when counting diff
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 May 2026 15:20:30 UTC
The branch stable/15 has been updated by aokblast:
URL: https://cgit.FreeBSD.org/src/commit/?id=560f38cec2f7a2f80f745a190e28f5f027b4cd18
commit 560f38cec2f7a2f80f745a190e28f5f027b4cd18
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-03-12 09:16:24 +0000
Commit: ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-05-29 15:19:48 +0000
kern_time: Honor the precise option when counting diff
When preecise option is used, the true elapsed time should also use the
precise timer.
This fixes the test case sleep_for.signals.pass.cpp in libcxx.
Reviewed by: kib, imp
Approved by: lwhsu (mentor)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55824
(cherry picked from commit 728ae49a6b81edb3eec5ab70a63bb83db8f5dce5)
---
sys/kern/kern_time.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 5b7485c25cd7..2cbb88a15b24 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -601,7 +601,9 @@ kern_clock_nanosleep(struct thread *td, clockid_t clock_id, int flags,
} while (error == 0 && is_abs_real && td->td_rtcgen == 0);
td->td_rtcgen = 0;
if (error != EWOULDBLOCK) {
- if (TIMESEL(&sbtt, tmp))
+ if (precise)
+ sbtt = sbinuptime();
+ else if (TIMESEL(&sbtt, tmp))
sbtt += tc_tick_sbt;
if (sbtt >= sbt)
return (0);