Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Sep 2024 18:35:24 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: 66145c3829c1 - main - ntptime: Use time_t for tv_sec related variables
Message-ID:  <202409061835.486IZOrs011351@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=66145c3829c1753f3b5fa303c4e36bba172be553

commit 66145c3829c1753f3b5fa303c4e36bba172be553
Author:     Sebastian Huber <sebastian.huber@embedded-brains.de>
AuthorDate: 2024-08-09 02:57:47 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2024-09-06 18:34:32 +0000

    ntptime: Use time_t for tv_sec related variables
    
    The struct timespec tv_sec member is of type time_t.  Make sure that all
    variables related to this member are of the type time_t.  This is important for
    targets where long is a 32-bit type and time_t a 64-bit type.
    
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1373
---
 sys/kern/kern_ntptime.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index d2a2761ed683..65746021028b 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -193,7 +193,7 @@ static l_fp pps_freq;			/* scaled frequency offset (ns/s) */
 static long pps_fcount;			/* frequency accumulator */
 static long pps_jitter;			/* nominal jitter (ns) */
 static long pps_stabil;			/* nominal stability (scaled ns/s) */
-static long pps_lastsec;		/* time at last calibration (s) */
+static time_t pps_lastsec;		/* time at last calibration (s) */
 static int pps_valid;			/* signal watchdog counter */
 static int pps_shift = PPS_FAVG;	/* interval duration (s) (shift) */
 static int pps_shiftmax = PPS_FAVGDEF;	/* max interval duration (s) (shift) */
@@ -742,7 +742,8 @@ hardupdate(long offset /* clock offset (ns) */)
 void
 hardpps(struct timespec *tsp, long delta_nsec)
 {
-	long u_sec, u_nsec, v_nsec; /* temps */
+	long u_nsec, v_nsec; /* temps */
+	time_t u_sec;
 	l_fp ftemp;
 
 	NTP_LOCK();



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