Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jan 2023 18:11:20 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c7c53e3ca631 - main - Clarify hardpps() parameter name and comment
Message-ID:  <202301301811.30UIBKrG015917@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c7c53e3ca6312c99a0e179e51357a1933de95b5a

commit c7c53e3ca6312c99a0e179e51357a1933de95b5a
Author:     Sebastian Huber <sebastian.huber@embedded-brains.de>
AuthorDate: 2023-01-25 12:43:11 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-01-30 18:07:40 +0000

    Clarify hardpps() parameter name and comment
    
    Since 32c203577a5e by phk in 1999 (Make even more of the PPSAPI
    implementations generic), the "nsec" parameter of hardpps() is a time
    difference and no longer a time point.  Change the name to "delta_nsec"
    and adjust the comment.
    
    Remove comment about a clock tick adjustment which is no longer in the code.
    
    Pull Request: https://github.com/freebsd/freebsd-src/pull/640
    Reviewed by: imp
---
 sys/kern/kern_ntptime.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index 96f14a408bcb..6d03413a3113 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -733,11 +733,11 @@ hardupdate(offset)
  * variables, except for the actual time and frequency variables, which
  * are determined by this routine and updated atomically.
  *
- * tsp  - time at PPS
- * nsec - hardware counter at PPS
+ * tsp  - time at current PPS event
+ * delta_nsec - time elapsed between the previous and current PPS event
  */
 void
-hardpps(struct timespec *tsp, long nsec)
+hardpps(struct timespec *tsp, long delta_nsec)
 {
 	long u_sec, u_nsec, v_nsec; /* temps */
 	l_fp ftemp;
@@ -774,12 +774,9 @@ hardpps(struct timespec *tsp, long nsec)
 	/*
 	 * Compute the difference between the current and previous
 	 * counter values. If the difference exceeds 0.5 s, assume it
-	 * has wrapped around, so correct 1.0 s. If the result exceeds
-	 * the tick interval, the sample point has crossed a tick
-	 * boundary during the last second, so correct the tick. Very
-	 * intricate.
+	 * has wrapped around, so correct 1.0 s.
 	 */
-	u_nsec = nsec;
+	u_nsec = delta_nsec;
 	if (u_nsec > (NANOSECOND >> 1))
 		u_nsec -= NANOSECOND;
 	else if (u_nsec < -(NANOSECOND >> 1))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202301301811.30UIBKrG015917>