[Git][NTPsec/ntpsec][master] lfp signed-integral-part encapsulation. These are simple cases.
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Dec 25 10:18:09 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
d1629e4e by Eric S. Raymond at 2016-12-25T05:17:02-05:00
lfp signed-integral-part encapsulation. These are simple cases.
- - - - -
8 changed files:
- include/timespecops.h
- libparse/clk_rawdcf.c
- libparse/clk_trimtsip.c
- ntpd/ntp_monitor.c
- ntpd/refclock_generic.c
- ntpd/refclock_gpsd.c
- ntpd/refclock_nmea.c
- ntpfrob/jitter.c
Changes:
=====================================
include/timespecops.h
=====================================
--- a/include/timespecops.h
+++ b/include/timespecops.h
@@ -337,7 +337,7 @@ lfp_intv_to_tspec(
L_NEG(&absx);
}
out.tv_nsec = FTOTVN(lfpfrac(absx));
- out.tv_sec = absx.l_i;
+ out.tv_sec = lfpsint(absx);
if (neg) {
out.tv_sec = -out.tv_sec;
out.tv_nsec = -out.tv_nsec;
=====================================
libparse/clk_rawdcf.c
=====================================
--- a/libparse/clk_rawdcf.c
+++ b/libparse/clk_rawdcf.c
@@ -509,7 +509,7 @@ calc_usecdiff(
l_fp delt;
delt = ref->fp;
- delt.l_i -= offset;
+ setlfpsint(delt, lfpsint(delt) + offset);
L_SUB(&delt, &base->fp);
delta = lfp_stamp_to_tspec(delt, NULL);
=====================================
libparse/clk_trimtsip.c
=====================================
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -224,7 +224,7 @@ cvt_trimtsip(
if (fetch_ieee754(&bp, IEEE_SINGLE, &secs, trim_offsets) != IEEE_OK)
return CVT_FAIL|CVT_BADFMT;
- if ((secs.l_i <= 0) ||
+ if ((lfpsint(secs) <= 0) ||
(t->t_utcknown == 0))
{
clock_time->flags = PARSEB_POWERUP;
=====================================
ntpd/ntp_monitor.c
=====================================
--- a/ntpd/ntp_monitor.c
+++ b/ntpd/ntp_monitor.c
@@ -337,7 +337,7 @@ ntp_monitor(
L_SUB(&interval_fp, &mon->last);
/* add one-half second to round up */
L_ADDUF(&interval_fp, 0x80000000);
- interval = interval_fp.l_i;
+ interval = lfpsint(interval_fp);
mon->last = rbufp->recv_time;
NSRCPORT(&mon->rmtadr) = NSRCPORT(&rbufp->recv_srcadr);
mon->count++;
@@ -434,7 +434,7 @@ ntp_monitor(
L_SUB(&interval_fp, &oldest->last);
/* add one-half second to round up */
L_ADDUF(&interval_fp, 0x80000000);
- oldest_age = interval_fp.l_i;
+ oldest_age = lfpsint(interval_fp);
}
/* note -1 is legal for mru_maxage (disables) */
if (oldest != NULL && mru_maxage < oldest_age) {
=====================================
ntpd/refclock_generic.c
=====================================
--- a/ntpd/refclock_generic.c
+++ b/ntpd/refclock_generic.c
@@ -3233,7 +3233,7 @@ parse_process(
l_fp off, rectime, reftime;
double fudge;
- /* silence warning: 'off.Ul_i.Xl_i' may be used uninitialized in this function */
+ /* silence warning: integral part may be used uninitialized in this function */
ZERO(off);
/*
@@ -3509,7 +3509,7 @@ parse_process(
#endif
if (PARSE_TIMECODE(parsetime->parse_state))
{
- if (M_ISGEQ(off.l_i, lfpfrac(off), -1, 0x80000000) &&
+ if (M_ISGEQ(lfpsint(off), lfpfrac(off), -1, 0x80000000) &&
M_ISGEQ(0, 0x7fffffff, off.l_i, lfpfrac(off)))
{
fudge = ppsphaseadjust; /* pick PPS fudge factor */
=====================================
ntpd/refclock_gpsd.c
=====================================
--- a/ntpd/refclock_gpsd.c
+++ b/ntpd/refclock_gpsd.c
@@ -1773,9 +1773,9 @@ gpsd_parse(
l_fp diff;
diff = up->ibt_local;
L_SUB(&diff, &up->pps_local);
- if (diff.l_i > 0)
+ if (lfpsint(diff) > 0)
up->fl_pps = 0; /* pps too old */
- else if (diff.l_i < 0)
+ else if (lfpsint(diff) < 0)
up->fl_ibt = 0; /* serial data too old */
}
=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -1801,7 +1801,7 @@ eval_gps_time(
/* merge in fractional offset */
retv = tspec_intv_to_lfp(*tofs);
- gps_sec += retv.l_i;
+ gps_sec += lfpsint(retv);
/* If we fully trust the GPS receiver, just combine days and
* seconds and be done. */
=====================================
ntpfrob/jitter.c
=====================================
--- a/ntpfrob/jitter.c
+++ b/ntpfrob/jitter.c
@@ -53,10 +53,10 @@ get_clocktime(
dtemp += sys_residual;
if (dtemp >= 1) {
dtemp -= 1;
- now->l_i++;
+ setlfpsint(*now, lfpsint(*now) + 1);
} else if (dtemp < -1) {
dtemp += 1;
- now->l_i--;
+ setlfpsint(*now, lfpsint(*now) - 1);
}
dtemp *= FRAC;
setlfpfrac(*now, (uint32_t)dtemp);
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/d1629e4e43bb0ad28369960229065ec4586e5d64
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161225/c1e5c15e/attachment.html>
More information about the vc
mailing list