From f623e4462c46e1aec7e439efcd08a4f9afd2700a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 9 Aug 2024 04:57:47 +0200 Subject: [PATCH] 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 d2a2761ed683af..65746021028be0 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();