git: 66145c3829c1 - main - ntptime: Use time_t for tv_sec related variables
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 06 Sep 2024 18:35:24 UTC
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();