git: 728ae49a6b81 - main - kern_time: Honor the precise option when counting diff
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 14 Mar 2026 04:31:33 UTC
The branch main has been updated by aokblast:
URL: https://cgit.FreeBSD.org/src/commit/?id=728ae49a6b81edb3eec5ab70a63bb83db8f5dce5
commit 728ae49a6b81edb3eec5ab70a63bb83db8f5dce5
Author: ShengYi Hung <aokblast@FreeBSD.org>
AuthorDate: 2026-03-12 09:16:24 +0000
Commit: ShengYi Hung <aokblast@FreeBSD.org>
CommitDate: 2026-03-14 04:21:26 +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
---
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 0c16045ca610..82c2f7367ab2 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);