Skip to content

Commit

Permalink
ntptime: Use time_t for tv_sec related variables
Browse files Browse the repository at this point in the history
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: freebsd#1373
  • Loading branch information
sebhub authored and bsdimp committed Sep 6, 2024
1 parent 7c9cc1b commit f623e44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sys/kern/kern_ntptime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit f623e44

Please sign in to comment.