[Git][NTPsec/ntpsec][master] 2 commits: Remove timesone-offsert argument of clocktime().
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Dec 3 15:34:18 UTC 2017
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
0843064f by Eric S. Raymond at 2017-12-03T09:51:53-05:00
Remove timesone-offsert argument of clocktime().
It was never called with anyting but GMT, and doing this allows eliminating
some dodgy casts from the implementation.
- - - - -
693dd71a by Eric S. Raymond at 2017-12-03T10:30:36-05:00
Experimental removal of HAVE_KERNEL_PLL.
This is a probe - which masy be reverted - to see if any of our
buildbot targets barf on the assumption that timex.h is present and
ntp_adjtime() works.
There might also be a subsidiary problem with STA_NANO as well.
- - - - -
12 changed files:
- include/ntp_stdlib.h
- libntp/clocktime.c
- libntp/statestr.c
- ntpd/ntp_control.c
- ntpd/ntp_loopfilter.c
- ntpd/ntp_refclock.c
- ntpd/ntp_timer.c
- ntpd/refclock_local.c
- ntpd/refclock_truetime.c
- tests/libntp/clocktime.c
- wafhelpers/options.py
- wscript
Changes:
=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -48,7 +48,7 @@ extern bool authreadkeys (const char *);
extern void authtrust (keyid_t, bool);
extern bool authusekey (keyid_t, int, const uint8_t *);
-extern int clocktime (int, int, int, int, int, int, time_t, uint32_t, uint32_t *, uint32_t *);
+extern int clocktime (int, int, int, int, int, time_t, uint32_t, uint32_t *, uint32_t *);
extern void init_auth (void);
extern void init_network (void);
extern void auth_prealloc_symkeys(int);
@@ -113,9 +113,7 @@ extern const char * eventstr (int);
extern const char * ceventstr (int);
extern const char * res_match_flags(unsigned short);
extern const char * res_access_flags(unsigned short);
-#ifdef HAVE_KERNEL_PLL
extern const char * k_st_flags (uint32_t);
-#endif
extern char * statustoa (int, int);
extern sockaddr_u * netof6 (sockaddr_u *);
extern char * numtoa (uint32_t);
=====================================
libntp/clocktime.c
=====================================
--- a/libntp/clocktime.c
+++ b/libntp/clocktime.c
@@ -31,8 +31,8 @@ static int32_t ntp_to_year(uint32_t, time_t);
static uint32_t year_to_ntp(int32_t);
/*
- * Take a time spec given as year, day-of-year, hour, minute and second as
- * well as a GMT offset in hours and convert it to a NTP time stamp in
+ * Take a time spec given as year, day-of-year, hour, minute and second
+ * (in GMT/UTC) and convert it to a NTP time stamp in
* '*ts_ui'. There are two cases: ether the year is > 99, in which
* case it is used, or it is < 99 in which case we ignore it and try
* to deduce a year,
@@ -58,7 +58,6 @@ clocktime(
int hour , /* hour of day */
int minute , /* minute of hour */
int second , /* second of minute */
- int tzoff , /* hours west of GMT */
time_t pivot , /* pivot for time unfolding */
uint32_t rec_ui , /* recent timestamp to get year from */
uint32_t *yearstart, /* cached start-of-year, secs from NTP epoch */
@@ -67,16 +66,17 @@ clocktime(
uint32_t ystt[3]; /* year start */
uint32_t test[3]; /* result time stamp */
uint32_t diff[3]; /* abs difference to receive */
- int32_t y, tmp, idx, min;
+ int32_t y, idx, min;
+ uint32_t tmp;
/*
- * Compute the offset into the year in seconds. Note that
- * this could come out to be a negative number.
+ * Compute the offset into the year in seconds. Can't
+ * be negative as yday is 1-origin.
*/
- tmp = ((int32_t)second +
- SECSPERMIN * ((int32_t)minute +
- MINSPERHR * ((int32_t)hour + (int32_t)tzoff +
- HRSPERDAY * ((int32_t)yday - 1))));
+ tmp = ((uint32_t)second +
+ SECSPERMIN * ((uint32_t)minute +
+ MINSPERHR * ((uint32_t)hour +
+ HRSPERDAY * ((uint32_t)yday - 1))));
/*
* Year > 1970 - from a 4-digit year stamp, must be greater
* than POSIX epoch. Means we're not dependent on the pivot
@@ -129,12 +129,12 @@ clocktime(
* around the guess and select the entry with the minimum
* absolute difference to the receive time stamp.
*/
- y = ntp_to_year(rec_ui - (unsigned int)tmp, pivot);
+ y = ntp_to_year(rec_ui - tmp, pivot);
for (idx = 0; idx < 3; idx++) {
/* -- get year start of potential solution */
ystt[idx] = year_to_ntp(y + idx - 1);
/* -- get time stamp of potential solution */
- test[idx] = ystt[idx] + (unsigned int)tmp;
+ test[idx] = ystt[idx] + tmp;
/* -- calc absolute difference to receive time */
diff[idx] = test[idx] - rec_ui;
if (diff[idx] >= 0x80000000u)
=====================================
libntp/statestr.c
=====================================
--- a/libntp/statestr.c
+++ b/libntp/statestr.c
@@ -12,9 +12,7 @@
#include "lib_strbuf.h"
#include "ntp_refclock.h"
#include "ntp_control.h"
-#ifdef HAVE_KERNEL_PLL
# include "ntp_syscall.h"
-#endif
/*
@@ -188,62 +186,28 @@ static const struct codestring res_access_bits[] = {
/* not used with getcode(), no terminating entry needed */
};
-#ifdef HAVE_KERNEL_PLL
/*
* kernel discipline status bits
*/
static const struct codestring k_st_bits[] = {
-# ifdef STA_PLL
{ STA_PLL, "pll" },
-# endif
-# ifdef STA_PPSFREQ
{ STA_PPSFREQ, "ppsfreq" },
-# endif
-# ifdef STA_PPSTIME
{ STA_PPSTIME, "ppstime" },
-# endif
-# ifdef STA_FLL
{ STA_FLL, "fll" },
-# endif
-# ifdef STA_INS
{ STA_INS, "ins" },
-# endif
-# ifdef STA_DEL
{ STA_DEL, "del" },
-# endif
-# ifdef STA_UNSYNC
{ STA_UNSYNC, "unsync" },
-# endif
-# ifdef STA_FREQHOLD
{ STA_FREQHOLD, "freqhold" },
-# endif
-# ifdef STA_PPSSIGNAL
{ STA_PPSSIGNAL, "ppssignal" },
-# endif
-# ifdef STA_PPSJITTER
{ STA_PPSJITTER, "ppsjitter" },
-# endif
-# ifdef STA_PPSWANDER
{ STA_PPSWANDER, "ppswander" },
-# endif
-# ifdef STA_PPSERROR
{ STA_PPSERROR, "ppserror" },
-# endif
-# ifdef STA_CLOCKERR
{ STA_CLOCKERR, "clockerr" },
-# endif
-# ifdef STA_NANO
{ STA_NANO, "nano" },
-# endif
-# ifdef STA_MODE
{ STA_MODE, "mode=fll" },
-# endif
-# ifdef STA_CLK
{ STA_CLK, "src=B" },
-# endif
/* not used with getcode(), no terminating entry needed */
};
-#endif /* HAVE_KERNEL_PLL */
/* Forwards */
static const char * getcode(int, const struct codestring *);
@@ -345,11 +309,9 @@ decode_bitflags(
(tab == peer_st_bits)
? "peer_st"
:
-#ifdef HAVE_KERNEL_PLL
(tab == k_st_bits)
? "kern_st"
:
-#endif
"",
(unsigned)bits, (int)LIB_BUFLENGTH);
errno = saved_errno;
@@ -388,7 +350,6 @@ res_access_flags(
}
-#ifdef HAVE_KERNEL_PLL
const char *
k_st_flags(
uint32_t st
@@ -396,8 +357,6 @@ k_st_flags(
{
return decode_bitflags((int)st, " ", k_st_bits, COUNTOF(k_st_bits));
}
-#endif /* HAVE_KERNEL_PLL */
-
/*
* statustoa - return a descriptive string for a peer status
=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -1436,7 +1436,6 @@ ctl_putsys(
double kb;
double dtemp;
const char *ss;
-#ifdef HAVE_KERNEL_PLL
static struct timex ntx;
static unsigned long ntp_adjtime_time;
@@ -1451,7 +1450,6 @@ ctl_putsys(
else
ntp_adjtime_time = current_time;
}
-#endif /* HAVE_KERNEL_PLL */
switch (varid) {
@@ -1824,93 +1822,50 @@ ctl_putsys(
break;
/*
- * CTL_IF_KERNLOOP() puts a zero if the kernel loop is
- * unavailable, otherwise calls putfunc with args.
- */
-#ifndef HAVE_KERNEL_PLL
-# define CTL_IF_KERNLOOP(putfunc, args) \
- ctl_putint(sys_var[varid].text, 0)
-#else
-# define CTL_IF_KERNLOOP(putfunc, args) \
- putfunc args
-#endif
-
- /*
- * CTL_IF_KERNPPS() puts a zero if either the kernel
- * loop is unavailable, or kernel hard PPS is not
+ * CTL_IF_KERNPPS() puts a zero if kernel hard PPS is not
* active, otherwise calls putfunc with args.
*/
-#ifndef HAVE_KERNEL_PLL
-# define CTL_IF_KERNPPS(putfunc, args) \
- ctl_putint(sys_var[varid].text, 0)
-#else
# define CTL_IF_KERNPPS(putfunc, args) \
if (0 == ntx.shift) \
ctl_putint(sys_var[varid].text, 0); \
else \
putfunc args /* no trailing ; */
-#endif
case CS_K_OFFSET:
- CTL_IF_KERNLOOP(
- ctl_putdblf,
- (sys_var[varid].text, 0, -1,
- ntp_error_in_seconds(ntx.offset) * MS_PER_S)
- );
+ ctl_putdblf(sys_var[varid].text, 0, -1,
+ ntp_error_in_seconds(ntx.offset) * MS_PER_S);
break;
case CS_K_FREQ:
- CTL_IF_KERNLOOP(
- ctl_putsfp,
- (sys_var[varid].text, ntx.freq)
- );
+ ctl_putsfp(sys_var[varid].text, ntx.freq);
break;
case CS_K_MAXERR:
- CTL_IF_KERNLOOP(
- ctl_putdblf,
- (sys_var[varid].text, 0, 6,
- ntp_error_in_seconds(ntx.maxerror) * MS_PER_S)
- );
+ ctl_putdblf(sys_var[varid].text, 0, 6,
+ ntp_error_in_seconds(ntx.maxerror) * MS_PER_S);
break;
case CS_K_ESTERR:
- CTL_IF_KERNLOOP(
- ctl_putdblf,
- (sys_var[varid].text, 0, 6,
- ntp_error_in_seconds(ntx.esterror) * MS_PER_S)
- );
+ ctl_putdblf(sys_var[varid].text, 0, 6,
+ ntp_error_in_seconds(ntx.esterror) * MS_PER_S);
break;
case CS_K_STFLAGS:
-#ifndef HAVE_KERNEL_PLL
- ss = "";
-#else
ss = k_st_flags((uint32_t)ntx.status);
-#endif
ctl_putstr(sys_var[varid].text, ss, strlen(ss));
break;
case CS_K_TIMECONST:
- CTL_IF_KERNLOOP(
- ctl_putint,
- (sys_var[varid].text, ntx.constant)
- );
+ ctl_putint(sys_var[varid].text, ntx.constant);
break;
case CS_K_PRECISION:
- CTL_IF_KERNLOOP(
- ctl_putdblf,
- (sys_var[varid].text, 0, 6,
- ntp_error_in_seconds(ntx.precision) * MS_PER_S)
- );
+ ctl_putdblf(sys_var[varid].text, 0, 6,
+ ntp_error_in_seconds(ntx.precision) * MS_PER_S);
break;
case CS_K_FREQTOL:
- CTL_IF_KERNLOOP(
- ctl_putsfp,
- (sys_var[varid].text, ntx.tolerance)
- );
+ ctl_putsfp(sys_var[varid].text, ntx.tolerance);
break;
case CS_K_PPS_FREQ:
=====================================
ntpd/ntp_loopfilter.c
=====================================
--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -22,10 +22,8 @@
#define NTP_MAXFREQ 500e-6
-#ifdef HAVE_KERNEL_PLL
# define FREQTOD(x) ((x) / 65536e6) /* NTP to double */
# define DTOFREQ(x) ((int32_t)((x) * 65536e6)) /* double to NTP */
-#endif
/*
* This is an implementation of the clock discipline algorithm described
@@ -123,16 +121,13 @@ double drift_comp; /* frequency (s/s) */
static double init_drift_comp; /* initial frequency (PPM) */
double clock_stability; /* frequency stability (wander) (s/s) */
unsigned int sys_tai; /* TAI offset from UTC */
-#if !defined(ENABLE_LOCKCLOCK) && defined(HAVE_KERNEL_PLL)
-static bool loop_started; /* true after LOOP_DRIFTINIT */
-#endif /* !ENABLE_LOCKCLOCK && HAVE_KERNEL_PLL */
#ifndef ENABLE_LOCKCLOCK
+static bool loop_started; /* true after LOOP_DRIFTINIT */
static void rstclock (int, double); /* transition function */
static double direct_freq(double); /* direct set frequency */
static void set_freq(double); /* set frequency */
#endif /* ENABLE_LOCKCLOCK */
-#ifdef HAVE_KERNEL_PLL
#ifndef PATH_MAX
# define PATH_MAX MAX_PATH
#endif
@@ -148,7 +143,6 @@ static unsigned int loop_tai; /* last TAI offset */
#endif /* ENABLE_LOCKCLOCK */
static void start_kern_loop(void);
static void stop_kern_loop(void);
-#endif /* HAVE_KERNEL_PLL */
/*
* Clock state machine control flags
@@ -157,14 +151,13 @@ bool ntp_enable = true; /* clock discipline enabled */
bool pll_control = false; /* kernel support available */
bool kern_enable = true; /* kernel support enabled */
bool hardpps_enable; /* kernel PPS discipline enabled */
-#ifdef HAVE_KERNEL_PLL
-static bool ext_enable; /* external clock enabled */
-#endif /* HAVE_KERNEL_PLL */
bool allow_panic = false; /* allow panic correction (-g) */
bool force_step_once = false; /* always step time once at startup (-G) */
bool mode_ntpdate = false; /* exit on first clock set (-q) */
int freq_cnt; /* initial frequency clamp */
+
static int freq_set; /* initial set frequency switch */
+static bool ext_enable; /* external clock enabled */
/*
* Clock state machine variables
@@ -184,7 +177,6 @@ static int sys_hufflen; /* huff-n'-puff filter stages */
static int sys_huffptr; /* huff-n'-puff filter pointer */
static double sys_mindly; /* huff-n'-puff filter min delay */
-#if defined(HAVE_KERNEL_PLL)
/* Emacs cc-mode goes nuts if we split the next line... */
#define MOD_BITS (MOD_OFFSET | MOD_MAXERROR | MOD_ESTERROR | \
MOD_STATUS | MOD_TIMECONST)
@@ -194,9 +186,7 @@ static struct sigaction sigsys; /* current sigaction status */
static struct sigaction newsigsys; /* new sigaction status */
static sigjmp_buf env; /* environment var. for pll_trap() */
#endif /* SIGSYS */
-#endif /* HAVE_KERNEL_PLL */
-#ifdef HAVE_KERNEL_PLL
#ifndef ENABLE_LOCKCLOCK
static void
sync_status(const char *what, int ostatus, int nstatus)
@@ -222,7 +212,6 @@ static char *file_name(void)
}
return this_file;
}
-#endif /* HAVE_KERNEL_PLL */
/*
* init_loopfilter - initialize loop filter data
@@ -238,7 +227,6 @@ init_loopfilter(void)
freq_cnt = (int)clock_minstep;
}
-#ifdef HAVE_KERNEL_PLL
/*
* ntp_adjtime_error_handler - process errors from ntp_adjtime
*/
@@ -441,7 +429,6 @@ or, from ntp_adjtime():
}
return;
}
-#endif
/*
* local_clock - the NTP logical clock loop filter.
@@ -467,9 +454,7 @@ local_clock(
#else
int rval; /* return code */
int osys_poll; /* old system poll */
-#ifdef HAVE_KERNEL_PLL
int ntp_adj_ret; /* returned by ntp_adjtime */
-#endif /* HAVE_KERNEL_PLL */
double mu; /* interval since last update */
double clock_frequency; /* clock frequency */
double dtemp, etemp; /* double temps */
@@ -738,7 +723,6 @@ local_clock(
}
}
-#ifdef HAVE_KERNEL_PLL
/*
* This code segment works when clock adjustments are made using
* precision time kernel support and the ntp_adjtime() system
@@ -854,7 +838,6 @@ local_clock(
}
#endif /* STA_NANO */
}
-#endif /* HAVE_KERNEL_PLL */
/*
* Clamp the frequency within the tolerance range and calculate
@@ -968,10 +951,8 @@ adj_host_clock(
} else if (freq_cnt > 0) {
offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(1));
freq_cnt--;
-#ifdef HAVE_KERNEL_PLL
} else if (pll_control && kern_enable) {
offset_adj = 0.;
-#endif /* HAVE_KERNEL_PLL */
} else {
offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(sys_poll));
}
@@ -982,11 +963,9 @@ adj_host_clock(
* set_freq(). Otherwise it is a component of the adj_systime()
* offset.
*/
-#ifdef HAVE_KERNEL_PLL
if (pll_control && kern_enable)
freq_adj = 0.;
else
-#endif /* HAVE_KERNEL_PLL */
freq_adj = drift_comp;
/* Bound absolute value of total adjustment to NTP_MAXFREQ. */
@@ -1078,7 +1057,6 @@ set_freq(
drift_comp = freq;
loop_desc = "ntpd";
-#ifdef HAVE_KERNEL_PLL
if (pll_control) {
int ntp_adj_ret;
ZERO(ntv);
@@ -1091,13 +1069,11 @@ set_freq(
ntp_adjtime_error_handler(__func__, &ntv, ntp_adj_ret, errno, false, false, __LINE__ - 1);
}
}
-#endif /* HAVE_KERNEL_PLL */
mprintf_event(EVNT_FSET, NULL, "%s %.6f PPM", loop_desc,
drift_comp * US_PER_S);
}
#endif /* HAVE_LOCKCLOCK */
-#ifdef HAVE_KERNEL_PLL
static void
start_kern_loop(void)
{
@@ -1158,10 +1134,8 @@ start_kern_loop(void)
"kernel time sync enabled");
}
}
-#endif /* HAVE_KERNEL_PLL */
-#ifdef HAVE_KERNEL_PLL
static void
stop_kern_loop(void)
{
@@ -1169,7 +1143,6 @@ stop_kern_loop(void)
report_event(EVNT_KERN, NULL,
"kernel time sync disabled");
}
-#endif /* HAVE_KERNEL_PLL */
/*
@@ -1182,21 +1155,17 @@ select_loop(
{
if (kern_enable == use_kern_loop)
return;
-#ifdef HAVE_KERNEL_PLL
if (pll_control && !use_kern_loop)
stop_kern_loop();
-#endif
kern_enable = use_kern_loop;
-#ifdef HAVE_KERNEL_PLL
if (pll_control && use_kern_loop)
start_kern_loop();
-#endif
/*
* If this loop selection change occurs after initial startup,
* call set_freq() to switch the frequency compensation to or
* from the kernel loop.
*/
-#if defined(HAVE_KERNEL_PLL) && !defined(ENABLE_LOCKCLOCK)
+#if !defined(ENABLE_LOCKCLOCK)
if (pll_control && loop_started)
set_freq(drift_comp);
#endif
@@ -1247,12 +1216,10 @@ loop_config(
*/
case LOOP_DRIFTINIT:
#ifndef ENABLE_LOCKCLOCK
-#ifdef HAVE_KERNEL_PLL
if (mode_ntpdate)
break;
start_kern_loop();
-#endif /* HAVE_KERNEL_PLL */
/*
* Initialize frequency if given; otherwise, begin frequency
@@ -1270,16 +1237,13 @@ loop_config(
rstclock(EVNT_FSET, 0);
else
rstclock(EVNT_NSET, 0);
-#ifdef HAVE_KERNEL_PLL
loop_started = true;
-#endif /* HAVE_KERNEL_PLL */
#endif /* !ENABLE_LOCKCLOCK */
break;
case LOOP_KERN_CLEAR:
#if 0 /* XXX: needs more review, and how can we get here? */
#ifndef ENABLE_LOCKCLOCK
-# ifdef HAVE_KERNEL_PLL
if (pll_control && kern_enable) {
memset((char *)&ntv, 0, sizeof(ntv));
ntv.modes = MOD_STATUS;
@@ -1289,7 +1253,6 @@ loop_config(
pll_status,
ntv.status);
}
-# endif /* HAVE_KERNEL_PLL */
#endif /* ENABLE_LOCKCLOCK */
#endif
break;
@@ -1369,7 +1332,7 @@ loop_config(
}
-#if defined(HAVE_KERNEL_PLL) && defined(SIGSYS)
+#if defined(SIGSYS)
/*
* _trap - trap processor for undefined syscalls
*
@@ -1387,4 +1350,4 @@ pll_trap(
pll_control = false;
siglongjmp(env, 1);
}
-#endif /* HAVE_KERNEL_PLL && SIGSYS */
+#endif /* SIGSYS */
=====================================
ntpd/ntp_refclock.c
=====================================
--- a/ntpd/ntp_refclock.c
+++ b/ntpd/ntp_refclock.c
@@ -413,7 +413,7 @@ refclock_process_f(
* to deducing the year from the receipt time of the sample if
* it finds only a 2-digit year in the timecode.
*/
- if (!clocktime(pp->year, pp->day, pp->hour, pp->minute, pp->second, GMT,
+ if (!clocktime(pp->year, pp->day, pp->hour, pp->minute, pp->second,
time(NULL), lfpuint(pp->lastrec), &pp->yearstart, &sec))
return false;
=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -13,9 +13,7 @@
#include <signal.h>
#include <unistd.h>
-#ifdef HAVE_KERNEL_PLL
#include "ntp_syscall.h"
-#endif /* HAVE_KERNEL_PLL */
#ifdef HAVE_TIMER_CREATE
/* TC_ERR represents the timer_create() error return value. */
@@ -377,11 +375,7 @@ check_leapsec(
leap_result_t lsdata;
uint32_t lsprox;
-#ifdef HAVE_KERNEL_PLL
leapsec_electric((pll_control && kern_enable) ? electric_on : electric_off);
-#else
- leapsec_electric(electric_off);
-#endif
#ifdef ENABLE_LEAP_SMEAR
leap_smear.enabled = (leap_smear_intv != 0);
#endif
=====================================
ntpd/refclock_local.c
=====================================
--- a/ntpd/refclock_local.c
+++ b/ntpd/refclock_local.c
@@ -131,9 +131,6 @@ local_poll(
struct peer *peer
)
{
-#if defined(HAVE_KERNEL_PLL) && defined(ENABLE_LOCKCLOCK)
- struct timex ntv;
-#endif /* HAVE_KERNEL_PLL ENABLE_LOCKCLOCK */
struct refclockproc *pp;
UNUSED_ARG(unit);
@@ -159,7 +156,8 @@ local_poll(
* If another process is disciplining the system clock, we set
* the leap bits and quality indicators from the kernel.
*/
-#if defined(HAVE_KERNEL_PLL) && defined(ENABLE_LOCKCLOCK)
+#if defined(ENABLE_LOCKCLOCK)
+ struct timex ntv;
memset(&ntv, 0, sizeof ntv);
switch (ntp_adjtime(&ntv)) {
case TIME_OK:
@@ -183,11 +181,11 @@ local_poll(
}
pp->disp = 0;
pp->jitter = 0;
-#else /* HAVE_KERNEL_PLL && ENABLE_LOCKCLOCK */
+#else /* ENABLE_LOCKCLOCK */
pp->leap = LEAP_NOWARNING;
pp->disp = DISPERSION;
pp->jitter = 0;
-#endif /* HAVE_KERNEL_PLL && ENABLE_LOCKCLOCK */
+#endif /* ENABLE_LOCKCLOCK */
pp->lastref = pp->lastrec;
refclock_receive(peer);
}
=====================================
ntpd/refclock_truetime.c
=====================================
--- a/ntpd/refclock_truetime.c
+++ b/ntpd/refclock_truetime.c
@@ -402,7 +402,7 @@ true_receive(
* the count from the PCL720
*/
if (!clocktime(pp->year, pp->day, pp->hour, pp->minute,
- pp->second, GMT, lfpuint(pp->lastrec),
+ pp->second, lfpuint(pp->lastrec),
&pp->yearstart, &sec)) {
refclock_report(peer, CEVNT_BADTIME);
return;
=====================================
tests/libntp/clocktime.c
=====================================
--- a/tests/libntp/clocktime.c
+++ b/tests/libntp/clocktime.c
@@ -33,13 +33,13 @@ TEST(clocktime, CurrentYear) {
const uint32_t timestamp = 3486372600UL;
const uint32_t expected = timestamp; // exactly the same.
- const int year=0, yday=175, hour=12, minute=50, second=0, tzoff=0;
+ const int year=0, yday=175, hour=12, minute=50, second=0;
uint32_t yearstart=0;
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
TEST_ASSERT_EQUAL(yearstart, 3471292800);
}
@@ -49,13 +49,13 @@ TEST(clocktime, CurrentYearExplicit) {
const uint32_t timestamp = 3486372600UL;
const uint32_t expected = timestamp; // exactly the same.
- const int year=2010, yday=175, hour=12, minute=50, second=0, tzoff=0;
+ const int year=2010, yday=175, hour=12, minute=50, second=0;
uint32_t yearstart=0;
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
/* If this assertion fails with "Expected 3486372600 was
* 104913720" that's a 32-bit integer overflow and your compiler
* is failing to cast to int properly inside clocktime.
@@ -77,33 +77,13 @@ TEST(clocktime, CurrentYearFuzz) {
const uint32_t timestamp = 3486372600UL; // 2010-06-24 12:50:00Z
const uint32_t expected = 3486369600UL; // 2010-06-24 12:00:00Z
- const int year=0, yday=175, hour=12, minute=0, second=0, tzoff=0;
+ const int year=0, yday=175, hour=12, minute=0, second=0;
uint32_t yearstart=0;
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
- TEST_ASSERT_EQUAL(expected, actual);
-}
-
-TEST(clocktime, TimeZoneOffset) {
- /*
- * Timestamp (rec_ui) is: 2010-06-24 12:00:00 +0800
- * (which is 2010-06-24 04:00:00Z)
- *
- * Time sent into function is 04:00:00 +0800
- */
- const uint32_t timestamp = 3486369600UL;
- const uint32_t expected = timestamp;
-
- const int year=0, yday=175, hour=4, minute=0, second=0, tzoff=8;
-
- uint32_t yearstart=0;
- uint32_t actual;
-
- TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
}
@@ -116,13 +96,13 @@ TEST(clocktime, WrongYearStart) {
const uint32_t timestamp = 3471418800UL;
const uint32_t expected = timestamp;
- const int year=0, yday=2, hour=11, minute=0, second=0, tzoff=0;
+ const int year=0, yday=2, hour=11, minute=0, second=0;
uint32_t yearstart = 302024100UL; // Yearstart of 2009.
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
}
@@ -135,13 +115,13 @@ TEST(clocktime, PreviousYear) {
const uint32_t timestamp = 3471296400UL;
const uint32_t expected = 3471289200UL;
- const int year=0, yday=365, hour=23, minute=0, second=0, tzoff=0;
+ const int year=0, yday=365, hour=23, minute=0, second=0;
uint32_t yearstart = 0;
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
}
@@ -154,12 +134,12 @@ TEST(clocktime, NextYear) {
const uint32_t timestamp = 3471289200UL;
const uint32_t expected = 3471296400UL;
- const int year=0, yday=1, hour=1, minute=0, second=0, tzoff=0;
+ const int year=0, yday=1, hour=1, minute=0, second=0;
uint32_t yearstart = 0;
uint32_t actual;
TEST_ASSERT_TRUE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
TEST_ASSERT_EQUAL(expected, actual);
}
@@ -167,12 +147,12 @@ TEST(clocktime, NoReasonableConversion) {
/* Timestamp is: 2010-01-02 11:00:00Z */
const uint32_t timestamp = 3471418800UL;
- const int year=0, yday=100, hour=12, minute=0, second=0, tzoff=0;
+ const int year=0, yday=100, hour=12, minute=0, second=0;
uint32_t yearstart = 0;
uint32_t actual;
TEST_ASSERT_FALSE(clocktime(year, yday, hour, minute, second,
- tzoff, fixedpivot, timestamp, &yearstart, &actual));
+ fixedpivot, timestamp, &yearstart, &actual));
}
TEST(clocktime, AlwaysInLimit) {
@@ -197,7 +177,7 @@ TEST(clocktime, AlwaysInLimit) {
ydayinc = prime_incs[whichprime];
for (hour = -204; hour < 204; hour += 2) {
for (minute = -60; minute < 60; minute++) {
- (void)clocktime(0, yday, hour, minute, 30, 0,
+ (void)clocktime(0, yday, hour, minute, 30,
fixedpivot, timestamp, &yearstart, &actual);
diff = actual - timestamp;
if (diff >= 0x80000000UL) {
@@ -214,7 +194,6 @@ TEST_GROUP_RUNNER(clocktime) {
RUN_TEST_CASE(clocktime, CurrentYear);
RUN_TEST_CASE(clocktime, CurrentYearExplicit);
RUN_TEST_CASE(clocktime, CurrentYearFuzz);
- RUN_TEST_CASE(clocktime, TimeZoneOffset);
RUN_TEST_CASE(clocktime, WrongYearStart);
RUN_TEST_CASE(clocktime, PreviousYear);
RUN_TEST_CASE(clocktime, NextYear);
=====================================
wafhelpers/options.py
=====================================
--- a/wafhelpers/options.py
+++ b/wafhelpers/options.py
@@ -21,8 +21,6 @@ def options_cmd(ctx, config):
default=False, help="Enable seccomp (restricts syscalls).")
grp.add_option('--disable-dns-lookup', action='store_true',
default=False, help="Disable DNS lookups.")
- grp.add_option('--disable-kernel-pll', action='store_true',
- default=False, help="Disable kernel PLL.")
grp.add_option('--disable-mdns-registration', action='store_true',
default=False, help="Disable MDNS registration.")
grp.add_option(
=====================================
wscript
=====================================
--- a/wscript
+++ b/wscript
@@ -787,21 +787,6 @@ int main(int argc, char **argv) {
ctx.define("HAVE_WORKING_FORK", 1,
comment="Whether a working fork() exists")
- # Does the kernel implement a phase-locked loop for timing?
- # All modern Unixes (in particular Linux and *BSD) have this.
- #
- # The README for the (now deleted) kernel directory says this:
- # "If the precision-time kernel (KERNEL_PLL define) is
- # configured, the installation process requires the header
- # file /usr/include/sys/timex.h for the particular
- # architecture to be in place."
- #
- if ((ctx.get_define("HAVE_SYS_TIMEX_H") and
- not ctx.options.disable_kernel_pll)):
- ctx.define("HAVE_KERNEL_PLL", 1,
- comment="Whether phase-locked loop for timing "
- "exists and is enabled")
-
# SO_REUSEADDR socket option is needed to open a socket on an
# interface when the port number is already in use on another
# interface. Linux needs this, NetBSD does not, status on
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/95d4d08108605abff53c4378eedafa1a71fce352...693dd71a42fe037c4b3efda0b2876ed9bd91c8e2
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/95d4d08108605abff53c4378eedafa1a71fce352...693dd71a42fe037c4b3efda0b2876ed9bd91c8e2
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20171203/a275131a/attachment.html>
More information about the vc
mailing list