[Git][NTPsec/ntpsec][master] 3 commits: Fix to work cleanly without asciidoc

Hal Murray gitlab at mg.gitlab.com
Wed Mar 15 05:05:46 UTC 2017


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
e803df69 by Hal Murray at 2017-03-14T22:04:41-07:00
Fix to work cleanly without asciidoc

- - - - -
2f421007 by Hal Murray at 2017-03-14T22:04:41-07:00
Remove unused cal*start from ntp_stdlib.h

- - - - -
2933de68 by Hal Murray at 2017-03-14T22:04:41-07:00
leap second cleanup

The leap second code now works in time_t (POSIX epoch).
The file format uses NTP epoch, but those are converted to POSIX epoch
as they are read in.

- - - - -


11 changed files:

- include/ntp_stdlib.h
- include/ntpd.h
- ntpd/ntp_control.c
- ntpd/ntp_leapsec.c
- ntpd/ntp_leapsec.h
- ntpd/ntp_proto.c
- ntpd/ntp_timer.c
- ntpd/ntp_util.c
- ntpd/ntpd.c
- tests/ntpd/leapsec.c
- tests/option-tester.sh


Changes:

=====================================
include/ntp_stdlib.h
=====================================
--- a/include/ntp_stdlib.h
+++ b/include/ntp_stdlib.h
@@ -55,17 +55,6 @@ extern	bool	authreadkeys	(const char *);
 extern	void	authtrust	(keyid_t, bool);
 extern	bool	authusekey	(keyid_t, int, const uint8_t *);
 
-/*
- * Based on the NTP timestamp, calculate the NTP timestamp of
- * the corresponding calendar unit. Use the pivot time to unfold
- * the NTP timestamp properly, or the current system time if the
- * pivot pointer is NULL.
- */
-extern	uint32_t	calyearstart	(uint32_t ntptime, const time_t *pivot);
-extern	uint32_t	calmonthstart	(uint32_t ntptime, const time_t *pivot);
-extern	uint32_t	calweekstart	(uint32_t ntptime, const time_t *pivot);
-extern	uint32_t	caldaystart	(uint32_t ntptime, const time_t *pivot);
-
 extern	const char *clockname	(int);
 extern	int	clocktime	(int, int, int, int, int, uint32_t, uint32_t *, uint32_t *);
 extern	void	init_auth	(void);


=====================================
include/ntpd.h
=====================================
--- a/include/ntpd.h
+++ b/include/ntpd.h
@@ -229,12 +229,12 @@ extern	void	record_clock_stats (struct peer *, const char *);
 extern	int	mprintf_clock_stats(struct peer *, const char *, ...)
 			NTP_PRINTF(2, 3);
 extern	void	record_raw_stats (sockaddr_u *srcadr, sockaddr_u *dstadr, l_fp *t1, l_fp *t2, l_fp *t3, l_fp *t4, int leap, int version, int mode, int stratum, int ppoll, int precision, double root_delay, double root_dispersion, uint32_t refid, u_int outcount);
-extern	void	check_leap_file	(int is_daily_check, uint32_t ntptime, const time_t * systime);
+extern	void	check_leap_file	(bool is_daily_check, time_t systime);
 extern	void	record_crypto_stats (sockaddr_u *, const char *);
 #ifdef DEBUG
 extern	void	record_timing_stats (const char *);
 #endif
-extern	char *	fstostr(time_t);	/* NTP timescale seconds */
+extern	char *	fstostr(time_t);
 
 /* packetstamp.c */
 extern void	enable_packetstamps(int, sockaddr_u *);


=====================================
ntpd/ntp_control.c
=====================================
--- a/ntpd/ntp_control.c
+++ b/ntpd/ntp_control.c
@@ -69,7 +69,7 @@ static	void	ctl_putrefid	(const char *, uint32_t);
 static	void	ctl_putarray	(const char *, double *, int);
 static	void	ctl_putsys	(int);
 static	void	ctl_putpeer	(int, struct peer *);
-static	void	ctl_putfs	(const char *, uint32_t);
+static	void	ctl_putfs	(const char *, time_t);
 #ifdef REFCLOCK
 static	void	ctl_putclock	(int, struct refclockstat *, int);
 #endif	/* REFCLOCK */
@@ -1202,15 +1202,14 @@ ctl_putuint(
 static void
 ctl_putfs(
 	const char *tag,
-	uint32_t uval
+	time_t uval
 	)
 {
 	register char *cp;
 	register const char *cq;
 	char buffer[200];
 	struct tm tmbuf, *tm = NULL;
-	uint32_t fstamp_u;
-	time_t fstamp;
+	time_t fstamp = uval;
 
 	cp = buffer;
 	cq = tag;
@@ -1218,11 +1217,8 @@ ctl_putfs(
 		*cp++ = *cq++;
 
 	*cp++ = '=';
-        /* Convert seconds from modulo NTP Epoch to POSIX Epoch */
-	fstamp_u = uval - JAN_1970;
-        fstamp = fstamp_u;          /* just in case time_t is not 32 bits */
 	tm = gmtime_r(&fstamp, &tmbuf);
-	if (NULL ==  tm)
+	if (NULL == tm)
 		return;
 	NTP_INSIST((cp - buffer) < (int)sizeof(buffer));
 	snprintf(cp, sizeof(buffer) - (size_t)(cp - buffer),


=====================================
ntpd/ntp_leapsec.c
=====================================
--- a/ntpd/ntp_leapsec.c
+++ b/ntpd/ntp_leapsec.c
@@ -40,24 +40,24 @@ static const char * const logPrefix = "leapsecond file";
 #define MAX_HIST 10	/* history of leap seconds */
 
 struct leap_info {
-	time64_t   ttime;	/* transition time (after the step, ntp scale) */
-	uint32_t stime;	/* schedule limit (a month before transition)  */
+	time_t   ttime;	/* transition time (after the step, POSIX epoch) */
+	time_t   stime;	/* schedule limit (a month before transition)  */
 	int16_t  taiof;	/* TAI offset on and after the transition      */
 	uint8_t  dynls; /* dynamic: inserted on peer/clock request     */
 };
 typedef struct leap_info leap_info_t;
 
 struct leap_head {
-	time64_t   update; /* time of information update                 */
-	time64_t   expire; /* table expiration time                      */
+	time_t   update; /* time of information update                 */
+	time_t   expire; /* table expiration time                      */
 	uint16_t size;	 /* number of infos in table	               */
 	int16_t  base_tai;	/* total leaps before first entry      */
 	int16_t  this_tai;	/* current TAI offset	               */
 	int16_t  next_tai;	/* TAI offset after 'when'             */
-	time64_t   dtime;	 /* due time (current era end)                 */
-	time64_t   ttime;	 /* nominal transition time (next era start)   */
-	time64_t   stime;	 /* schedule time (when we take notice)        */
-	time64_t   ebase;	 /* base time of this leap era                 */
+	time_t   dtime;	 /* due time (current era end)                 */
+	time_t   ttime;	 /* nominal transition time (next era start)   */
+	time_t   stime;	 /* schedule time (when we take notice)        */
+	time_t   ebase;	 /* base time of this leap era                 */
 	uint8_t  dynls;	 /* next leap is dynamic (by peer request)     */
 };
 typedef struct leap_head leap_head_t;
@@ -77,12 +77,18 @@ static bool   add_range(leap_table_t*, const leap_info_t*);
 static char * get_line(leapsec_reader, void*, char*, size_t);
 static char * skipws(char*);
 static bool   parsefail(const char * cp, const char * ep);
-static void   reload_limits(leap_table_t*, const time64_t);
-static bool   betweenu32(uint32_t, uint32_t, uint32_t);
+static void   reload_limits(leap_table_t*, time_t);
 static void   reset_times(leap_table_t*);
-static bool   leapsec_add(leap_table_t*, const time64_t, int);
-static bool   leapsec_raw(leap_table_t*, const time64_t, int, int);
-static char * lstostr(const time64_t ts);
+static bool   leapsec_add(leap_table_t*, time_t, int);
+static bool   leapsec_raw(leap_table_t*, time_t, int, bool);
+static char * lstostr(time_t ts);
+
+/* time_t is unsigned.  This is used for infinity in tables */
+#if NTP_SIZEOF_TIME_T == 8
+# define LAST_time_t 0x7fffffffffffffff
+#elif NTP_SIZEOF_TIME_T == 4
+# define LAST_time_t 0x7fffffff
+#endif
 
 /* =====================================================================
  * Get & Set the current leap table
@@ -91,7 +97,7 @@ static char * lstostr(const time64_t ts);
 /* ------------------------------------------------------------------ */
 leap_table_t *
 leapsec_get_table(
-	int alternate)
+	bool alternate)
 {
 	leap_table_t *p1, *p2;
 
@@ -167,19 +173,14 @@ bool
 leapsec_load(
 	leap_table_t * pt  ,
 	leapsec_reader func,
-	void *         farg,
-	int            use_build_limit)
+	void *         farg)
 {
 	char   *cp, *ep, linebuf[50];
-	time64_t ttime, limit;
+	time_t ttime;
+	uint64_t ntp;  /* Time from file with NTP epoch of 1900 */
 	long   taiof;
-	struct calendar build;
 
 	leapsec_clear(pt);
-	if (use_build_limit && ntpcal_get_build_date(&build))
-		limit = ntpcal_date_to_ntp64(&build);
-	else
-		memset(&limit, 0, sizeof(limit));
 
 	while (get_line(func, farg, linebuf, sizeof(linebuf))) {
 		cp = linebuf;
@@ -187,33 +188,31 @@ leapsec_load(
 			cp++;
 			if (*cp == '@') {
 				cp = skipws(cp+1);
-				settime64u(pt->head.expire, strtoull(cp, &ep, 10));
+				ntp = strtoull(cp, &ep, 10);
 				if (parsefail(cp, ep))
 					goto fail_read;
-				pt->lsig.etime = time64lo(pt->head.expire);
+				pt->head.expire = ntp - JAN_1970;
+				pt->lsig.etime = pt->head.expire;
 			} else if (*cp == '$') {
 				cp = skipws(cp+1);
-				settime64u(pt->head.update, strtoull(cp, &ep, 10));
+				ntp = strtoull(cp, &ep, 10);
 				if (parsefail(cp, ep))
 					goto fail_read;
-			}		    
+				pt->head.update = ntp - JAN_1970;
+			}
 		} else if (isdigit((uint8_t)*cp)) {
-		    settime64u(ttime, strtoull(cp, &ep, 10));
+			ntp = strtoull(cp, &ep, 10);
 			if (parsefail(cp, ep))
 				goto fail_read;
+			ttime = ntp - JAN_1970;
 			cp = skipws(ep);
 			taiof = strtol(cp, &ep, 10);
 			if (   parsefail(cp, ep)
 			    || taiof > SHRT_MAX || taiof < SHRT_MIN)
 				goto fail_read;
-			if (ttime >= limit) {
-				if (!leapsec_raw(pt, ttime,
-						 taiof, false))
-					goto fail_insn;
-			} else {
-				pt->head.base_tai = (int16_t)taiof;
-			}
-			pt->lsig.ttime = time64lo(ttime);
+			if (!leapsec_raw(pt, ttime, taiof, false))
+				goto fail_insn;
+			pt->lsig.ttime = ttime;
 			pt->lsig.taiof = (int16_t)taiof;
 		}
 	}
@@ -236,25 +235,26 @@ leapsec_dump(
 	leapsec_dumper       func,
 	void *               farg)
 {
-	int             idx;
-	time64_t          ts;
-	struct calendar atb, ttb;
+	int       idx;
+	time_t    ts;
+	struct tm   atb, ttb;
 
-	ntpcal_ntp64_to_date(&ttb, pt->head.expire);
+	ts = pt->head.expire;
+	gmtime_r(&ts, &ttb);
 	(*func)(farg, "leap table (%u entries) expires at %04u-%02u-%02u:\n",
 		pt->head.size,
-		ttb.year, ttb.month, ttb.monthday);
+		ttb.tm_year+1900, ttb.tm_mon+1, ttb.tm_mday);
 	idx = pt->head.size;
 	while (idx-- != 0) {
 		ts = pt->info[idx].ttime;
-		ntpcal_ntp64_to_date(&ttb, ts);
-		ts = ts - pt->info[idx].stime;
-		ntpcal_ntp64_to_date(&atb, ts);
+		gmtime_r(&ts, &ttb);
+		ts = ts - pt->info[idx].stime;   // FIXME ???
+		gmtime_r(&ts, &atb);
 
 		(*func)(farg, "%04u-%02u-%02u [%c] (%04u-%02u-%02u) - %d\n",
-			ttb.year, ttb.month, ttb.monthday,
+			ttb.tm_year+1900, ttb.tm_mon+1, ttb.tm_mday,
 			"-*"[pt->info[idx].dynls != 0],
-			atb.year, atb.month, atb.monthday,
+			atb.tm_year+1900, atb.tm_mon+1, atb.tm_mday,
 			pt->info[idx].taiof);
 	}
 }
@@ -265,28 +265,25 @@ leapsec_dump(
 
 bool
 leapsec_query(
-	leap_result_t * qr   ,
-	uint32_t        ts32 ,
-	const time_t *  pivot)
+	leap_result_t * qr,
+	time_t        when)
 {
 	leap_table_t *   pt;
-	time64_t           ts64, last, next;
-	uint32_t         due32;
+	time_t         last, next;
 	bool             fired;
 
 	/* preset things we use later on... */
 	fired = false;
-	ts64  = ntpcal_ntp_to_ntp(ts32, pivot);
 	pt    = leapsec_get_table(false);
 	memset(qr, 0, sizeof(leap_result_t));
 
-	if (ts64 < pt->head.ebase) {
+	if (when < pt->head.ebase) {
 		/* Most likely after leap frame reset. Could also be a
 		 * backstep of the system clock. Anyway, get the new
 		 * leap era frame.
 		 */
-		reload_limits(pt, ts64);
-	} else if (ts64 >= pt->head.dtime) {
+		reload_limits(pt, when);
+	} else if (when >= pt->head.dtime) {
 		/* Boundary crossed in forward direction. This might
 		 * indicate a leap transition, so we prepare for that
 		 * case.
@@ -296,14 +293,13 @@ leapsec_query(
 		 * both modes is easier to maintain.
 		 */
 		last = pt->head.ttime;
-		qr->warped = (int16_t)(time64lo(last) -
-				       time64lo(pt->head.dtime));
-		next = ts64 + qr->warped;
+		// FIXME warped is only 16 bits.  ????
+		qr->warped = (uint16_t)(last - pt->head.dtime);
+		next = when + qr->warped;
 		reload_limits(pt, next);
 		fired = (pt->head.ebase == last);
 		if (fired) {
-			ts64 = next;
-			ts32 = time64lo(next);
+			when = next;
 		} else {
 			qr->warped = 0;
 		}
@@ -312,25 +308,27 @@ leapsec_query(
 	qr->tai_offs = pt->head.this_tai;
 
 	/* If before the next scheduling alert, we're done. */
-	if (ts64 < pt->head.stime)
+	if (when < pt->head.stime)
 		return fired;
 
 	/* now start to collect the remaining data */
-	due32 = time64lo(pt->head.dtime);
-
 	qr->tai_diff  = pt->head.next_tai - pt->head.this_tai;
 	qr->ttime     = pt->head.ttime;
-	qr->ddist     = due32 - ts32;
+	qr->ddist     = pt->head.dtime - when;
 	qr->dynamic   = pt->head.dynls;
-	qr->proximity = LSPROX_SCHEDULE;
 
+	qr->proximity = LSPROX_SCHEDULE;
 	/* if not in the last day before transition, we're done. */
-	if (!betweenu32(due32 - SECSPERDAY, ts32, due32))
-		return fired;
+
+	if (when >= pt->head.dtime)
+		return fired;	/* Future */
+
+	if (when < pt->head.dtime - SECSPERDAY)
+		return fired;	/* Before last day */
 	
 	qr->proximity = LSPROX_ANNOUNCE;
-	if (!betweenu32(due32 - 10, ts32, due32))
-		return fired;
+	if (when < pt->head.dtime - 10)
+		return fired;	/* Before last 10 seconds */
 
 	/* The last 10s before the transition. Prepare for action! */
 	qr->proximity = LSPROX_ALERT;
@@ -413,7 +411,7 @@ leapsec_load_stream(
 
 	rewind(ifp);
 	pt = leapsec_get_table(true);
-	if (!leapsec_load(pt, (leapsec_reader)getc, ifp, true)) {
+	if (!leapsec_load(pt, (leapsec_reader)getc, ifp)) {
 		switch (errno) {
 		case EINVAL:
 			msyslog(LOG_ERR, "%s ('%s'): bad transition time",
@@ -522,62 +520,49 @@ leapsec_getsig(
 /* ------------------------------------------------------------------ */
 bool
 leapsec_expired(
-	uint32_t       when,
-	const time_t * tpiv)
+	time_t       when)
 {
 	const leap_table_t * pt;
-	time64_t limit;
 
 	pt = leapsec_get_table(false);
-	limit = ntpcal_ntp_to_ntp(when, tpiv);
-	return (limit >= pt->head.expire);
+	return (when >= pt->head.expire);
 }
 
 /* ------------------------------------------------------------------ */
 int32_t
 leapsec_daystolive(
-	uint32_t       when,
-	const time_t * tpiv)
+	time_t limit)
 {
 	const leap_table_t * pt;
-	time64_t limit;
+	long secs_left;
 
 	pt = leapsec_get_table(false);
-	limit = ntpcal_ntp_to_ntp(when, tpiv);
-	limit = pt->head.expire - limit;
-	return ntpcal_daysplit(limit).hi;
+	secs_left = pt->head.expire - limit;
+	if (secs_left < 0)
+		secs_left -= (SECSPERDAY-1);
+	return secs_left/SECSPERDAY;
 }
 
 /* ------------------------------------------------------------------ */
 bool
 leapsec_add_fix(
-	int            total,
-	uint32_t       ttime,
-	uint32_t       etime,
-	const time_t * pivot)
+	int          tai_offset,
+	time_t       ttime,
+	time_t       etime)
 {
-	time_t         tpiv;
 	leap_table_t * pt;
-	time64_t         tt64, et64;
 
-	if (pivot == NULL) {
-		time(&tpiv);
-		pivot = &tpiv;
-	}
-	
-	et64 = ntpcal_ntp_to_ntp(etime, pivot);
-	tt64 = ntpcal_ntp_to_ntp(ttime, pivot);
 	pt   = leapsec_get_table(true);
 
-	if ((et64 <= pt->head.expire)
-	   || !leapsec_raw(pt, tt64, total, false) )
+	if ((etime <= pt->head.expire)
+	   || !leapsec_raw(pt, ttime, tai_offset, false) )
 		return false;
 
 	pt->lsig.etime = etime;
 	pt->lsig.ttime = ttime;
-	pt->lsig.taiof = (int16_t)total;
+	pt->lsig.taiof = (int16_t)tai_offset;
 
-	pt->head.expire = et64;
+	pt->head.expire = etime;
 
 	return leapsec_set_table(pt);
 }
@@ -585,16 +570,13 @@ leapsec_add_fix(
 /* ------------------------------------------------------------------ */
 bool
 leapsec_add_dyn(
-	bool           insert,
-	uint32_t       ntpnow,
-	const time_t * pivot )
+	bool         insert,
+	time_t       when)
 {
 	leap_table_t * pt;
-	time64_t         now64;
 
 	pt = leapsec_get_table(true);
-	now64 = ntpcal_ntp_to_ntp(ntpnow, pivot);
-	return (   leapsec_add(pt, now64, insert)
+	return (leapsec_add(pt, when, insert)
 		&& leapsec_set_table(pt));
 }
 
@@ -613,7 +595,7 @@ static void
 reset_times(
 	leap_table_t * pt)
 {
-	memset(&pt->head.ebase, 0xFF, sizeof(time64_t));
+	pt->head.ebase = LAST_time_t;
 	pt->head.stime = pt->head.ebase;
 	pt->head.ttime = pt->head.ebase;
 	pt->head.dtime = pt->head.ebase;
@@ -721,7 +703,7 @@ parsefail(
 static void
 reload_limits(
 	leap_table_t * pt,
-	const time64_t ts)
+	time_t ts)
 {
 	int idx;
 
@@ -739,7 +721,7 @@ reload_limits(
 	 * empty -- no undefined condition must arise from this code.
 	 */
 	if (idx >= pt->head.size) {
-		memset(&pt->head.ebase, 0x00, sizeof(time64_t));
+		pt->head.ebase = 0;
 		pt->head.this_tai = pt->head.base_tai;
 	} else {
 		pt->head.ebase    = pt->info[idx].ttime;
@@ -759,7 +741,7 @@ reload_limits(
 		pt->head.stime =  pt->head.ttime - pt->info[idx].stime;
 
 	} else {
-		memset(&pt->head.ttime, 0xFF, sizeof(time64_t));
+		pt->head.ttime = LAST_time_t;
 		pt->head.stime    = pt->head.ttime;
 		pt->head.dtime    = pt->head.ttime;
 		pt->head.next_tai = pt->head.this_tai;
@@ -779,44 +761,47 @@ reload_limits(
  */
 static bool
 leapsec_add(
-	leap_table_t*  pt    ,
-	const time64_t   now64 ,
+	leap_table_t*  pt,
+	const time_t   now,
 	int            insert)
 {
-	time64_t		ttime, starttime;
-	struct calendar	fts;
+	time_t		ttime, starttime;
+	struct tm	fts;
 	leap_info_t	li;
 
-	/* Check against the table expiration and the lates available
+	/* Check against the table expiration and the latest available
 	 * leap entry. Do not permit inserts, only appends, and only if
 	 * the extend the table beyond the expiration!
 	 */
-	if ((now64 < pt->head.expire)
-	    || (pt->head.size && (now64 <= pt->info[0].ttime))) {
+	if ((now < pt->head.expire)
+	    || (pt->head.size && (now <= pt->info[0].ttime))) {
 		errno = ERANGE;
 		return false;
 	}
 
-	ntpcal_ntp64_to_date(&fts, now64);
+	gmtime_r(&now, &fts);
 	/* To guard against dangling leap flags: do not accept leap
 	 * second request on the 1st hour of the 1st day of the month.
 	 */
-	if (fts.monthday == 1 && fts.hour == 0) {
+	if (fts.tm_mday == 1 && fts.tm_hour == 0) {
 		errno = EINVAL;
 		return false;
 	}
 
 	/* Ok, do the remaining calculations */
-	fts.monthday = 1;
-	fts.hour     = 0;
-	fts.minute   = 0;
-	fts.second   = 0;
-	starttime = ntpcal_date_to_ntp64(&fts);
-	fts.month++;
-	ttime = ntpcal_date_to_ntp64(&fts);
-
+	fts.tm_mday = 1;
+	fts.tm_hour = 0;
+	fts.tm_min  = 0;
+	fts.tm_sec  = 0;
+	starttime = mktime(&fts);
+	fts.tm_mon++;
+	if (fts.tm_mon == 12) {
+		fts.tm_mon = 0;
+		fts.tm_year++;
+	}
+	ttime = mktime(&fts);
 	li.ttime = ttime;
-	li.stime = time64lo(ttime) - time64lo(starttime);
+	li.stime = ttime - starttime;
 	li.taiof = (pt->head.size ? pt->info[0].taiof : pt->head.base_tai)
 	         + (insert ? 1 : -1);
 	li.dynls = 1;
@@ -831,12 +816,12 @@ leapsec_add(
 bool
 leapsec_raw(
 	leap_table_t * pt,
-	const time64_t   ttime,
+	const time_t   ttime,
 	int            taiof,
-	int            dynls)
+	bool           dynls)
 {
-	time64_t		starttime;
-	struct calendar	fts;
+	time_t		starttime;
+	struct tm	fts;
 	leap_info_t	li;
 
 	/* Check that we only extend the table. Paranoia rulez! */
@@ -845,39 +830,21 @@ leapsec_raw(
 		return false;
 	}
 
-	ntpcal_ntp64_to_date(&fts, ttime);
+	gmtime_r(&ttime, &fts);
 	/* If this does not match the exact month start, bail out. */
-	if (fts.monthday != 1 || fts.hour || fts.minute || fts.second) {
+	if (fts.tm_mday != 1 || fts.tm_hour || fts.tm_min || fts.tm_sec) {
 		errno = EINVAL;
 		return false;
 	}
-	fts.month--; /* was in range 1..12, no overflow here! */
-	starttime    = ntpcal_date_to_ntp64(&fts);
+	/* Start 28 days earler.  Avoids month arithmetic.  */
+	starttime = ttime - 28*SECSPERDAY;
 	li.ttime = ttime;
-	li.stime = time64lo(ttime) - time64lo(starttime);
+	li.stime = ttime - starttime;
 	li.taiof = (int16_t)taiof;
-	li.dynls = (dynls != 0);
+	li.dynls = dynls;
 	return add_range(pt, &li);
 }
 
-/* [internal] Do a wrap-around save range inclusion check.
- * Returns true if x in [lo,hi[ (intervall open on right side) with full
- * handling of an overflow / wrap-around.
- */
-static bool
-betweenu32(
-	uint32_t lo,
-	uint32_t x,
-	uint32_t hi)
-{
-	int rc;
-
-	if (lo <= hi)
-		rc = (lo <= x) && (x < hi);
-	else
-		rc = (lo <= x) || (x < hi);
-	return rc;
-}
 
 /* =====================================================================
  * validation stuff
@@ -986,19 +953,19 @@ leapsec_validate(
 }
 
 /*
- * lstostr - prettyprint NTP seconds
+ * lstostr - prettyprint POSIX seconds
  */
 static char * lstostr(
-	const time64_t ts)
+	const time_t ts)
 {
-	char *		buf;
-	struct calendar tm;
+	char *	buf;
+	struct tm tm;
 
 	LIB_GETBUF(buf);
-	ntpcal_ntp64_to_date(&tm, ts);
+	gmtime_r(&ts, &tm);
 	snprintf(buf, LIB_BUFLENGTH, "%04d-%02d-%02dT%02d:%02dZ",
-			 tm.year, tm.month, tm.monthday,
-			 tm.hour, tm.minute);
+			 tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+			 tm.tm_hour, tm.tm_min);
 	return buf;
 }
 


=====================================
ntpd/ntp_leapsec.h
=====================================
--- a/ntpd/ntp_leapsec.h
+++ b/ntpd/ntp_leapsec.h
@@ -85,7 +85,7 @@ extern bool leapsec_electric(electric_mode el);
  * 'dynamic' != 0 if entry was requested by clock/peer
  */ 
 struct leap_result {
-	time64_t   ttime;
+	time_t   ttime;
 	uint32_t ddist;
 	int16_t  tai_offs;
 	int16_t  tai_diff;
@@ -96,9 +96,9 @@ struct leap_result {
 typedef struct leap_result leap_result_t;
 
 struct leap_signature {
-	uint32_t etime;	/* expiration time	*/
-	uint32_t ttime;	/* transition time	*/
-	int16_t  taiof;	/* total offset to TAI	*/
+	time_t   etime;  /* expiration time */
+	time_t   ttime;  /* transition time */
+	int16_t  taiof;  /* total offset to TAI	*/
 };
 typedef struct leap_signature leap_signature_t;
 
@@ -128,7 +128,7 @@ typedef struct leap_smear_info leap_smear_info_t;
  * pointer will automatically copy the primary table, so it can be
  * subsequently modified.
  */
-extern leap_table_t *leapsec_get_table(int alternate);
+extern leap_table_t *leapsec_get_table(bool alternate);
 
 /* Set the current leap table. Accepts only return values from
  * 'leapsec_get_table()', so it's hard to do something wrong. Returns
@@ -143,8 +143,7 @@ extern void leapsec_clear(leap_table_t*);
  * register with their TAI offset) leap entries before the build date.
  * Update the leap signature data on the fly.
  */
-extern bool leapsec_load(leap_table_t*, leapsec_reader,
-				void*, int blimit);
+extern bool leapsec_load(leap_table_t*, leapsec_reader, void*);
 
 /* Dump the current leap table in readable format, using the provided
  * dump formatter function.
@@ -176,13 +175,13 @@ extern void        leapsec_getsig(leap_signature_t * psig);
 
 /* Check if the leap table is expired at the given time.
  */
-extern bool leapsec_expired(uint32_t when, const time_t * pivot);
+extern bool leapsec_expired(time_t when);
 
 /* Get the distance to expiration in days.
  * Returns negative values if expired, zero if there are less than 24hrs
  * left, and positive numbers otherwise.
  */
-extern int32_t leapsec_daystolive(uint32_t when, const time_t * pivot);
+extern int32_t leapsec_daystolive(time_t limit);
 
 /* Reset the current leap frame, so the next query will do proper table
  * lookup from fresh. Suppresses a possible leap era transition detection
@@ -195,8 +194,7 @@ extern void leapsec_reset_frame(void);
  * works if the existing table is extended. On success, updates the
  * signature data.
  */
-extern bool leapsec_add_fix(int offset, uint32_t ttime, uint32_t etime,
-				   const time_t * pivot);
+extern bool leapsec_add_fix(int offset, time_t ttime, time_t etime);
 
 /* Take a time stamp and create a leap second frame for it. This will
  * schedule a leap second for the beginning of the next month, midnight
@@ -210,8 +208,7 @@ extern bool leapsec_add_fix(int offset, uint32_t ttime, uint32_t etime,
  * 'ntp_now' is subject to era unfolding. The entry is marked
  * dynamic. The leap signature is NOT updated.
  */
-extern bool leapsec_add_dyn(bool insert, uint32_t ntp_now,
-				   const time_t * pivot);
+extern bool leapsec_add_dyn(bool insert, time_t ntp_now);
 
 /* Take a time stamp and get the associated leap information. The time
  * stamp is subject to era unfolding around the pivot or the current
@@ -220,8 +217,7 @@ extern bool leapsec_add_dyn(bool insert, uint32_t ntp_now,
  * last and the current query. In that case, qr->warped contains the
  * required clock stepping, which is always zero in electric mode.
  */
-extern bool leapsec_query(leap_result_t *qr, uint32_t ntpts,
-				 const time_t * pivot);
+extern bool leapsec_query(leap_result_t *qr, time_t when);
 
 /* Get the current leap frame info. Returns true if the result contains
  * useable data, false if there is currently no leap second frame.


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1021,7 +1021,7 @@ clock_update(
 	)
 {
 	double	dtemp;
-	l_fp	now;
+	time_t	now;
 #ifdef HAVE_LIBSCF_H
 	char	*fmri;
 #endif /* HAVE_LIBSCF_H */
@@ -1164,13 +1164,13 @@ clock_update(
 		if (leapsec == LSPROX_NOWARN) {
 			if (leap_vote_ins > leap_vote_del
 			    && leap_vote_ins > sys_survivors / 2) {
-				get_systime(&now);
-				leapsec_add_dyn(true, lfpuint(now), NULL);
+				time(&now);
+				leapsec_add_dyn(true, now);
 			}
 			if (leap_vote_del > leap_vote_ins
 			    && leap_vote_del > sys_survivors / 2) {
-				get_systime(&now);
-				leapsec_add_dyn(false, lfpuint(now), NULL);
+				time(&now);
+				leapsec_add_dyn(false, now);
 			}
 		}
 		break;


=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -22,7 +22,7 @@
 # define	TC_ERR	(-1)
 #endif
 
-static void check_leapsec(uint32_t, const time_t*, bool);
+static void check_leapsec(time_t, bool);
 
 /*
  * These routines provide support for the event timer.  The timer is
@@ -197,8 +197,7 @@ timer(void)
 {
 	struct peer *	p;
 	struct peer *	next_peer;
-	l_fp		now;
-	time_t          tnow;
+	time_t          now;
 
 	/*
 	 * The basic timerevent is one second.  This is used to adjust the
@@ -265,15 +264,14 @@ timer(void)
 		sys_rootdisp = 0;
 	}
 
-	get_systime(&now);
-	time(&tnow);
+	time(&now);
 
 	/*
 	 * Leapseconds. Get time and defer to worker if either something
 	 * is imminent or every 8th second.
 	 */
 	if (leapsec > LSPROX_NOWARN || 0 == (current_time & 7))
-		check_leapsec(lfpuint(now), &tnow,
+		check_leapsec(now,
                                 (sys_leap == LEAP_NOTINSYNC));
         if (sys_leap != LEAP_NOTINSYNC) {
                 if (leapsec >= LSPROX_ANNOUNCE && leapdif) {
@@ -316,9 +314,9 @@ timer(void)
 		write_stats();
 		if (leapf_timer <= current_time) {
 			leapf_timer += SECSPERDAY;
-			check_leap_file(true, lfpuint(now), &tnow);
+			check_leap_file(true, now);
 		} else {
-			check_leap_file(false, lfpuint(now), &tnow);
+			check_leap_file(false, now);
 		}
 	}
 }
@@ -384,9 +382,8 @@ check_leap_sec_in_progress( const leap_result_t *lsdata ) {
 
 static void
 check_leapsec(
-	uint32_t        now  ,
-	const time_t * tpiv ,
-        bool           reset)
+	time_t now,
+        bool   reset)
 {
 	static const char leapmsg_p_step[] =
 	    "Positive leap second, stepped backward.";
@@ -402,7 +399,6 @@ check_leapsec(
 
 	leap_result_t lsdata;
 	uint32_t       lsprox;
-	
 #ifdef HAVE_KERNEL_PLL
 	leapsec_electric((pll_control && kern_enable) ? electric_on : electric_off);
 #else
@@ -416,10 +412,10 @@ check_leapsec(
 		leapsec_reset_frame();
 		memset(&lsdata, 0, sizeof(lsdata));
 	} else {
-		int fired = leapsec_query(&lsdata, now, tpiv);
+		int fired = leapsec_query(&lsdata, now);
 
-		DPRINTF(1, ("*** leapsec_query: fired %i, now %u (0x%08X), tai_diff %i, ddist %u\n",
-		      fired, now, now, lsdata.tai_diff, lsdata.ddist));
+		DPRINTF(1, ("*** leapsec_query: fired %i, now %lli (0x%llX), tai_diff %i, ddist %u\n",
+		      fired, (long long)now, (long long)now, lsdata.tai_diff, lsdata.ddist));
 #ifdef ENABLE_LEAP_SMEAR
 		leap_smear.in_progress = false;
 		leap_smear.doffset = 0.0;
@@ -428,7 +424,7 @@ check_leapsec(
 		      if (lsdata.tai_diff) {
 			      if (leap_smear.interval == 0) {
 				      leap_smear.interval = leap_smear_intv;
-				      leap_smear.intv_end = time64u(lsdata.ttime);
+				      leap_smear.intv_end = lsdata.ttime;
 				      leap_smear.intv_start = leap_smear.intv_end - leap_smear.interval;
 				      DPRINTF(1, ("*** leapsec_query: setting leap_smear interval %li, begin %.0f, end %.0f\n",
 					      leap_smear.interval, leap_smear.intv_start, leap_smear.intv_end));
@@ -467,9 +463,9 @@ check_leapsec(
 					      leap_smear.intv_start, leap_smear.intv_end, leap_smear.interval,
 					      now, leap_smear_time, leap_smear.doffset);
 #else
-				      DPRINTF(1, ("*** leapsec_query: [%.0f:%.0f] (%li), now %u (%.0f), smear offset %.6f ms\n",
+				      DPRINTF(1, ("*** leapsec_query: [%.0f:%.0f] (%li), now %lld (%.0f), smear offset %.6f ms\n",
 					      leap_smear.intv_start, leap_smear.intv_end, leap_smear.interval,
-					      now, leap_smear_time, leap_smear.doffset));
+					      (long long)now, leap_smear_time, leap_smear.doffset));
 #endif
 
 			      }


=====================================
ntpd/ntp_util.c
=====================================
--- a/ntpd/ntp_util.c
+++ b/ntpd/ntp_util.c
@@ -37,10 +37,10 @@
  * File names
  */
 static	char *key_file_name;		/* keys file name */
-static char	  *leapfile_name;		/* leapseconds file name */
+static char *leapfile_name;		/* leapseconds file name */
 static struct stat leapfile_stat;	/* leapseconds file stat() buffer */
-static bool        have_leapfile = false;
-char	*stats_drift_file;		/* frequency file name */
+static bool have_leapfile = false;
+char *stats_drift_file;			/* frequency file name */
 static double wander_resid;		/* last frequency update */
 double	wander_threshold = 1e-7;	/* initial frequency threshold */
 
@@ -79,7 +79,7 @@ static double prev_drift_comp;		/* last frequency update */
 static	void	record_sys_stats(void);
 static	void	record_use_stats(void);
 	void	ntpd_time_stepped(void);
-static  void	check_leap_expiration(int, uint32_t, const time_t*);
+static  void	check_leap_expiration(bool, time_t);
 
 /* 
  * Prototypes
@@ -231,7 +231,6 @@ stats_config(
 	const char *value;
 	size_t	len;
 	double	new_drift = 0;
-	l_fp	now;
 	time_t  ttnow;
 
 	value = invalue;
@@ -322,23 +321,22 @@ stats_config(
 		{
 			leap_signature_t lsig;
 
-			get_systime(&now);
 			time(&ttnow);
 			leapsec_getsig(&lsig);
 			mprintf_event(EVNT_TAI, NULL,
-				      "%d leap %s %s %s",
-				      lsig.taiof,
-				      fstostr(lsig.ttime),
-				      leapsec_expired(lfpuint(now), NULL)
-					  ? "expired"
-					  : "expires",
-				      fstostr(lsig.etime));
+				"%d leap %s %s %s",
+				lsig.taiof,
+				fstostr(lsig.ttime),
+				leapsec_expired(ttnow)
+					? "expired"
+					: "expires",
+				fstostr(lsig.etime));
 			have_leapfile = true;
 
 			/* force an immediate daily expiration check of
 			 * the leap seconds table
 			 */
-			check_leap_expiration(true, lfpuint(now), &ttnow);
+			check_leap_expiration(true, ttnow);
 		}
 		break;
 
@@ -522,7 +520,6 @@ record_raw_stats(
 	double	root_dispersion,/* seconds */
 	uint32_t	refid,
 	u_int	outcount
-
 	)
 {
 	l_fp	now;
@@ -632,11 +629,11 @@ void record_use_stats(void)
 		    "%lu %s %lu %.3f %.3f %lu %lu %lu %lu %lu %lu %lu %lu %lu\n",
 		    day, ulfptoa(now, 3), current_time - use_stattime,
 		    utime, stime,
-		    usage.ru_minflt -  oldusage.ru_minflt,
-		    usage.ru_majflt -  oldusage.ru_majflt,
-		    usage.ru_nswap -   oldusage.ru_nswap,
-		    usage.ru_inblock - oldusage.ru_inblock,
-		    usage.ru_oublock - oldusage.ru_oublock,
+		    usage.ru_minflt -   oldusage.ru_minflt,
+		    usage.ru_majflt -   oldusage.ru_majflt,
+		    usage.ru_nswap -    oldusage.ru_nswap,
+		    usage.ru_inblock -  oldusage.ru_inblock,
+		    usage.ru_oublock -  oldusage.ru_oublock,
 		    usage.ru_nvcsw -    oldusage.ru_nvcsw,
 		    usage.ru_nivcsw -   oldusage.ru_nivcsw,
 		    usage.ru_nsignals - oldusage.ru_nsignals,
@@ -725,9 +722,8 @@ record_timing_stats(
  */
 void
 check_leap_file(
-	int           is_daily_check,
-	uint32_t      ntptime       ,
-	const time_t *systime
+	bool   is_daily_check,
+	time_t systime
 	)
 {
 	/* just do nothing if there is no leap file */
@@ -742,7 +738,7 @@ check_leap_file(
 	else if (!have_leapfile)
 		return;
 
-	check_leap_expiration(is_daily_check, ntptime, systime);
+	check_leap_expiration(is_daily_check, systime);
 }
 
 /*
@@ -750,9 +746,8 @@ check_leap_file(
  */
 static void
 check_leap_expiration(
-	int           is_daily_check,
-	uint32_t      ntptime       ,
-	const time_t *systime
+	bool   is_daily_check,
+	time_t systime
 	)
 {
 	static const char * const logPrefix = "leapsecond file";
@@ -762,7 +757,7 @@ check_leap_expiration(
 	 * level and frequency (once/hour or once/day, depending on the
 	 * state.
 	 */
-	rc = leapsec_daystolive(ntptime, systime);	
+	rc = leapsec_daystolive(systime);
 	if (rc == 0) {
 		msyslog(LOG_WARNING,
 			"%s ('%s'): will expire in less than one day",
@@ -825,23 +820,27 @@ ntp_exit(int retval)
 #endif
 
 /*
- * fstostr - prettyprint NTP seconds
+ * fstostr - prettyprint time stamp - POSIX epoch
  */
 char * fstostr(
-	time_t	ntp_stamp
+	time_t	posix_stamp
 	)
 {
 	char *		buf;
-	struct calendar tm;
+	struct tm tm, *tm2;
 
 	LIB_GETBUF(buf);
-	if (ntpcal_ntp_to_date(&tm, (uint32_t)ntp_stamp, NULL) < 0)
-		snprintf(buf, LIB_BUFLENGTH, "ntpcal_ntp_to_date: %ld: range error",
-			 (long)ntp_stamp);
+	tm2 = gmtime_r(&posix_stamp, &tm);
+	if (tm2 == NULL || tm.tm_year > 9999)
+		snprintf(buf, LIB_BUFLENGTH, "fstostr: %ld: range error",
+			 (long)posix_stamp);
+	// if (ntpcal_ntp_to_date(&tm, (uint32_t)ntp_stamp, NULL) < 0)
+	//	snprintf(buf, LIB_BUFLENGTH, "ntpcal_ntp_to_date: %ld: range error",
+	//		 (long)ntp_stamp);
 	else
 		snprintf(buf, LIB_BUFLENGTH, "%04d%02d%02d%02d%02d",
-			 tm.year, tm.month, tm.monthday,
-			 tm.hour, tm.minute);
+			tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
+			tm.tm_hour, tm.tm_min);
 	return buf;
 }
 


=====================================
ntpd/ntpd.c
=====================================
--- a/ntpd/ntpd.c
+++ b/ntpd/ntpd.c
@@ -928,11 +928,9 @@ static void mainloop(void)
 			reopen_logfile();
 
 			{
-			l_fp snow;
 			time_t tnow;
-			get_systime(&snow);
 			time(&tnow);
-			check_leap_file(false, lfpuint(snow), &tnow);
+			check_leap_file(false, tnow);
 			}
 		}
 


=====================================
tests/ntpd/leapsec.c
=====================================
--- a/tests/ntpd/leapsec.c
+++ b/tests/ntpd/leapsec.c
@@ -236,8 +236,8 @@ static const char leap_gthash [] = {
     "#h	1151a8f e85a5069 9000fcdb 3d5e5365 1d505b37"
 };
 
-static uint32_t lsec2009 = 3439756800u; // 1 Jan 2009, 00:00:00 utc
-static uint32_t lsec2012 = 3550089600u; // 1 Jul 2012, 00:00:00 utc
+static time_t lsec2009 = 3439756800u - JAN_1970; // 1 Jan 2009, 00:00:00 utc
+static time_t lsec2012 = 3550089600u - JAN_1970; // 1 Jul 2012, 00:00:00 utc
 
 static int stringreader(void* farg)
 {
@@ -250,12 +250,11 @@ static int stringreader(void* farg)
 
 static bool
 setup_load_table(
-	const char * cp,
-	bool          blim)
+	const char * cp)
 {
 	bool            rc;
 	leap_table_t * pt = leapsec_get_table(0);
-	rc = (pt != NULL) && leapsec_load(pt, stringreader, &cp, blim);
+	rc = (pt != NULL) && leapsec_load(pt, stringreader, &cp);
 	rc = rc && leapsec_set_table(pt);
 	return rc;
 }
@@ -390,12 +389,12 @@ TEST(leapsec, loadFileExpire) {
 	int rc;
 	leap_table_t * pt = leapsec_get_table(0);
 
-	rc =   leapsec_load(pt, stringreader, &cp, false)
+	rc =   leapsec_load(pt, stringreader, &cp)
 	    && leapsec_set_table(pt);
 	TEST_ASSERT_EQUAL(1, rc);
-	rc = leapsec_expired(3439756800u, NULL);
+	rc = leapsec_expired(3439756800u - JAN_1970);
 	TEST_ASSERT_EQUAL(0, rc);
-	rc = leapsec_expired(3610569601u, NULL);
+	rc = leapsec_expired(3610569601u - JAN_1970);
 	TEST_ASSERT_EQUAL(1, rc);
 }
 
@@ -405,25 +404,24 @@ TEST(leapsec, loadFileTTL) {
 	const char *cp = leap1;
 	int rc;
 	leap_table_t * pt = leapsec_get_table(0);
-	time_t         pivot = 0x70000000;
 
-	const uint32_t limit = 3610569600u;
+	const time_t limit = 3610569600u - JAN_1970;
 
-	rc =   leapsec_load(pt, stringreader, &cp, false)
+	rc =   leapsec_load(pt, stringreader, &cp)
 	    && leapsec_set_table(pt);
 	TEST_ASSERT_EQUAL(1, rc);
 
 	// exactly 1 day to live
-	rc = leapsec_daystolive(limit - 86400, &pivot);
+	rc = leapsec_daystolive(limit - 86400);
 	TEST_ASSERT_EQUAL( 1, rc);
 	// less than 1 day to live
-	rc = leapsec_daystolive(limit - 86399, &pivot);
+	rc = leapsec_daystolive(limit - 86399);
 	TEST_ASSERT_EQUAL( 0, rc);
 	// hit expiration exactly
-	rc = leapsec_daystolive(limit, &pivot);
+	rc = leapsec_daystolive(limit);
 	TEST_ASSERT_EQUAL( 0, rc);
 	// expired since 1 sec
-	rc = leapsec_daystolive(limit + 1, &pivot);
+	rc = leapsec_daystolive(limit + 1);
 	TEST_ASSERT_EQUAL(-1, rc);
 }
 
@@ -433,23 +431,27 @@ TEST(leapsec, lsQueryPristineState) {
 	int            rc;
 	leap_result_t  qr;
 
-	rc = leapsec_query(&qr, lsec2012, NULL);
+	leap_table_t * pt = leapsec_get_table(0);
+	leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+	rc = leapsec_query(&qr, lsec2012);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 }
 
+
 // ----------------------------------------------------------------------
 // ad-hoc jump: leap second at 2009.01.01 -60days
 TEST(leapsec, ls2009faraway) {
   	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_EQUAL(1, rc);
 
 	// test 60 days before leap. Nothing scheduled or indicated.
-	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(33, qr.tai_offs);
 	TEST_ASSERT_EQUAL(0,  qr.tai_diff);
@@ -462,11 +464,11 @@ TEST(leapsec, ls2009weekaway) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_EQUAL(1, rc);
 
 	// test 7 days before leap. Leap scheduled, but not yet indicated.
-	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(33, qr.tai_offs);
 	TEST_ASSERT_EQUAL(1,  qr.tai_diff);
@@ -479,11 +481,11 @@ TEST(leapsec, ls2009houraway) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_EQUAL(1, rc);
 
 	// test 1 hour before leap. 61 true seconds to go.
-	rc = leapsec_query(&qr, lsec2009 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2009 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(33, qr.tai_offs);
 	TEST_ASSERT_EQUAL(1,  qr.tai_diff);
@@ -496,11 +498,11 @@ TEST(leapsec, ls2009secaway) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 
 	// test 1 second before leap (last boundary...) 2 true seconds to go.
-	rc = leapsec_query(&qr, lsec2009 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(33, qr.tai_offs);
 	TEST_ASSERT_EQUAL(1,  qr.tai_diff);
@@ -513,11 +515,11 @@ TEST(leapsec, ls2009onspot) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 
 	// test on-spot: treat leap second as already gone.
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(34, qr.tai_offs);
 	TEST_ASSERT_EQUAL(0,  qr.tai_diff);
@@ -534,7 +536,7 @@ TEST(leapsec, ls2009nodata) {
 	TEST_ASSERT_TRUE(rc);
 
 	// test on-spot with empty table
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,  qr.tai_offs);
 	TEST_ASSERT_EQUAL(0,  qr.tai_diff);
@@ -544,16 +546,26 @@ TEST(leapsec, ls2009nodata) {
 // ----------------------------------------------------------------------
 // test handling of the leap second at 2009.01.01 with culled data
 TEST(leapsec, ls2009limdata) {
+	leap_table_t * pt;
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 1);
+	rc = setup_load_table(leap1);
+	pt = leapsec_get_table(0);
+	leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+
+	// FIXME
+	// This used to check against build date
+	// That updated the header but didn't add slots.
+	// So the last slot was the only answer it could return.
+
 	TEST_ASSERT_TRUE(rc);
 
-	// test on-spot with limited table - does not work if build before 2013!
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	// test on-spot with limited table
+	rc = leapsec_query(&qr, lsec2009+10);
 	TEST_ASSERT_FALSE(rc);
-	TEST_ASSERT_EQUAL(35, qr.tai_offs);
+	TEST_ASSERT_EQUAL(34, qr.tai_offs);
+	// TEST_ASSERT_EQUAL(35, qr.tai_offs);
 	TEST_ASSERT_EQUAL(0,  qr.tai_diff);
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 }
@@ -561,6 +573,7 @@ TEST(leapsec, ls2009limdata) {
 // ----------------------------------------------------------------------
 // add dynamic leap second (like from peer/clock)
 TEST(leapsec, addDynamic) {
+	leap_table_t * pt;
 	bool           rc;
 	int            idx;
 
@@ -575,17 +588,19 @@ TEST(leapsec, addDynamic) {
 		0 // sentinel
 	};
 
-	rc = setup_load_table(leap2, 0);
+	rc = setup_load_table(leap2);
 	TEST_ASSERT_TRUE(rc);
 
 	for (idx=1; insns[idx]; ++idx) {
-	    rc = leapsec_add_dyn(true, insns[idx] - 20*SECSPERDAY - 100, NULL);
-		TEST_ASSERT_TRUE(rc);
+	    rc = leapsec_add_dyn(true, insns[idx]-JAN_1970 - 20*SECSPERDAY - 100);
+	    TEST_ASSERT_TRUE(rc);
 	}
 	// try to slip in a previous entry
-	rc = leapsec_add_dyn(true, insns[0] - 20*SECSPERDAY - 100, NULL);
+	rc = leapsec_add_dyn(true, insns[0]-JAN_1970 - 20*SECSPERDAY - 100);
 	TEST_ASSERT_FALSE(rc);
 	//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
+	pt = leapsec_get_table(0);
+	leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
 }
 
 // ----------------------------------------------------------------------
@@ -595,17 +610,17 @@ TEST(leapsec, addFixed) {
     int            idx;
 
 	static const struct { uint32_t tt; int of; } insns[] = {
-		{2982009600u, 29},//	# 1 Jul 1994
-		{3029443200u, 30},//	# 1 Jan 1996
-		{3076704000u, 31},//	# 1 Jul 1997
-		{3124137600u, 32},//	# 1 Jan 1999
-		{3345062400u, 33},//	# 1 Jan 2006
-		{3439756800u, 34},//	# 1 Jan 2009
-		{3550089600u, 35},//	# 1 Jul 2012
+		{2982009600u-JAN_1970, 29},//	# 1 Jul 1994
+		{3029443200u-JAN_1970, 30},//	# 1 Jan 1996
+		{3076704000u-JAN_1970, 31},//	# 1 Jul 1997
+		{3124137600u-JAN_1970, 32},//	# 1 Jan 1999
+		{3345062400u-JAN_1970, 33},//	# 1 Jan 2006
+		{3439756800u-JAN_1970, 34},//	# 1 Jan 2009
+		{3550089600u-JAN_1970, 35},//	# 1 Jul 2012
 		{0,0} // sentinel
 	};
 
-	rc = setup_load_table(leap2, 0);
+	rc = setup_load_table(leap2);
 	TEST_ASSERT_TRUE(rc);
 
 	// try to get in BAD time stamps...
@@ -613,8 +628,7 @@ TEST(leapsec, addFixed) {
 	    rc = leapsec_add_fix(
 		insns[idx].of,
 		insns[idx].tt - 20*SECSPERDAY - 100,
-		insns[idx].tt + SECSPERDAY,
-		NULL);
+		insns[idx].tt + SECSPERDAY);
 		TEST_ASSERT_FALSE(rc);
 	}
 	// no do it right
@@ -622,16 +636,14 @@ TEST(leapsec, addFixed) {
 		rc = leapsec_add_fix(
 		    insns[idx].of,
 		    insns[idx].tt,
-		    insns[idx].tt + SECSPERDAY,
-		    NULL);
+		    insns[idx].tt + SECSPERDAY);
 		TEST_ASSERT_TRUE(rc);
 	}
 	// try to slip in a previous entry
 	rc = leapsec_add_fix(
 	    insns[0].of,
 	    insns[0].tt,
-	    insns[0].tt + SECSPERDAY,
-	    NULL);
+	    insns[0].tt + SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	//leapsec_dump(pt, (leapsec_dumper)fprintf, stdout);
 }
@@ -646,38 +658,38 @@ TEST(leapsec, ls2009seqInsElectric) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 	leapsec_electric(1);
 	TEST_ASSERT_TRUE(leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2009 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call, same time frame: no trigger!
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -689,42 +701,42 @@ TEST(leapsec, ls2009seqInsDumb) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0, leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2009 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009+1, NULL);
+	rc = leapsec_query(&qr, lsec2009+1);
 	TEST_ASSERT_TRUE(rc)
 	TEST_ASSERT_EQUAL(-1,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call, same time frame: no trigger!
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -737,38 +749,38 @@ TEST(leapsec, ls2009seqDelElectric) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap3, 0);
+	rc = setup_load_table(leap3);
 	TEST_ASSERT_TRUE(rc);
 	leapsec_electric(1);
 	TEST_ASSERT_TRUE(leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2009 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call, same time frame: no trigger!
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -780,37 +792,37 @@ TEST(leapsec, ls2009seqDelDumb) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap3, 0);
+	rc = setup_load_table(leap3);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0, leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2009 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 2, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 2);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2009 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2009 - 1);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(1,              qr.warped);
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call, same time frame: no trigger!
-	rc = leapsec_query(&qr, lsec2009, NULL);
+	rc = leapsec_query(&qr, lsec2009);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -822,38 +834,38 @@ TEST(leapsec, ls2012seqInsElectric) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 	leapsec_electric(1);
 	TEST_ASSERT_TRUE(leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2012 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2012 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012, NULL);
+	rc = leapsec_query(&qr, lsec2012);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0,            qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call, same time frame: no trigger!
-	rc = leapsec_query(&qr, lsec2012, NULL);
+	rc = leapsec_query(&qr, lsec2012);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -865,44 +877,44 @@ TEST(leapsec, ls2012seqInsDumb) {
 	bool           rc;
 	leap_result_t  qr;
 
-	rc = setup_load_table(leap1, 0);
+	rc = setup_load_table(leap1);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(0, leapsec_electric(-1));
 
-	rc = leapsec_query(&qr, lsec2012 - 60*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 60*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - 7*SECSPERDAY, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 7*SECSPERDAY);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_SCHEDULE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - SECSPERHR, NULL);
+	rc = leapsec_query(&qr, lsec2012 - SECSPERHR);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ANNOUNCE, qr.proximity);
 
-	rc = leapsec_query(&qr, lsec2012 - 1, NULL);
+	rc = leapsec_query(&qr, lsec2012 - 1);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,               qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT,    qr.proximity);
 
 	// This is just 1 sec before transition!
-	rc = leapsec_query(&qr, lsec2012, NULL);
+	rc = leapsec_query(&qr, lsec2012);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,            qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_ALERT, qr.proximity);
 
 	// NOW the insert/backwarp must happen
-	rc = leapsec_query(&qr, lsec2012+1, NULL);
+	rc = leapsec_query(&qr, lsec2012+1);
 	TEST_ASSERT_TRUE(rc);
 	TEST_ASSERT_EQUAL(-1,            qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
 
 	// second call with transition time: no trigger!
-	rc = leapsec_query(&qr, lsec2012, NULL);
+	rc = leapsec_query(&qr, lsec2012);
 	TEST_ASSERT_FALSE(rc);
 	TEST_ASSERT_EQUAL(0,             qr.warped   );
 	TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -914,14 +926,13 @@ TEST(leapsec, lsEmptyTableDumb) {
 	bool           rc;
 	leap_result_t  qr;
 	uint32_t       t;
-	const time_t   pivot = lsec2012;
 	const uint32_t t0   = lsec2012 - 10;
 	const uint32_t tE   = lsec2012 + 10;
 
 	TEST_ASSERT_EQUAL(0, leapsec_electric(-1));
 
 	for (t = t0; t != tE; ++t) {
-		rc = leapsec_query(&qr, t, &pivot);
+		rc = leapsec_query(&qr, t);
 		TEST_ASSERT_FALSE(rc);
 		TEST_ASSERT_EQUAL(0,             qr.warped   );
 		TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);
@@ -933,16 +944,16 @@ TEST(leapsec, lsEmptyTableDumb) {
 TEST(leapsec, lsEmptyTableElectric) {
 	bool           rc;
 	leap_result_t  qr;
-    time_t         t;
-	leapsec_electric(1);
-	TEST_ASSERT_TRUE(leapsec_electric(-1));
+	time_t       t;
+
+	leapsec_electric(electric_on);
+	TEST_ASSERT_EQUAL(electric_on, leapsec_electric(electric_query));
 
-	const time_t   pivot = lsec2012;
 	const time_t   t0 = lsec2012 - 10;
 	const time_t   tE = lsec2012 + 10;
 
 	for (t = t0; t != tE; ++t) {
-		rc = leapsec_query(&qr, (uint32_t)t, &pivot);
+		rc = leapsec_query(&qr, t);
 		TEST_ASSERT_FALSE(rc);
 		TEST_ASSERT_EQUAL(0,             qr.warped   );
 		TEST_ASSERT_EQUAL(LSPROX_NOWARN, qr.proximity);


=====================================
tests/option-tester.sh
=====================================
--- a/tests/option-tester.sh
+++ b/tests/option-tester.sh
@@ -46,7 +46,8 @@ then
 doit linux   "--enable-classic-mode --enable-early-droproot --enable-seccomp"
 fi
 
-if [ `which asciidoc` != "" -a `which xsltproc` != "" ]
+if [ "`which asciidoc 2>/dev/null`" != "" -a \
+     "`which xsltproc 2>/dev/null`" != "" ]
 then
 doit doc     "--enable-doc"
 fi



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/2c0887778e48867706bde21df3794c477d90feb2...2933de68de5e079e15d0ef478ef266066903e7b7
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170315/b432a26d/attachment.html>


More information about the vc mailing list