[Git][NTPsec/ntpsec][master] Finish up simple encapsulations for l_fp fields.
Eric S. Raymond
gitlab at mg.gitlab.com
Sun Dec 25 13:11:25 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
62dc2547 by Eric S. Raymond at 2016-12-25T08:09:53-05:00
Finish up simple encapsulations for l_fp fields.
After this we get to trickier individual cases.
- - - - -
7 changed files:
- libparse/clk_trimtsip.c
- libparse/parse.c
- ntpd/ntp_filegen.c
- ntpd/ntp_proto.c
- ntpd/ntp_timer.c
- ntpd/refclock_nmea.c
- ntpd/refclock_oncore.c
Changes:
=====================================
libparse/clk_trimtsip.c
=====================================
--- a/libparse/clk_trimtsip.c
+++ b/libparse/clk_trimtsip.c
@@ -244,11 +244,11 @@ cvt_trimtsip(
L_SUB(&secs, &utcoffset); /* adjust GPS time to UTC time */
gpstolfp((unsigned short)week, (unsigned short)0,
- secs.l_ui, &gpstime);
+ lfpuint(secs), &gpstime);
setlfpfrac(gpstime, lfpfrac(secs));
- clock_time->utctime = gpstime.l_ui - JAN_1970;
+ clock_time->utctime = lfpuint(gpstime) - JAN_1970;
clock_time->usecond = lfp_intv_to_tspec(gpstime).tv_nsec / 1000;
@@ -330,7 +330,7 @@ cvt_trimtsip(
if (fetch_ieee754(&lbp, IEEE_SINGLE, &t0t, trim_offsets) != IEEE_OK)
return CVT_FAIL|CVT_BADFMT;
- t->t_utcknown = t0t.l_ui != 0;
+ t->t_utcknown = lfpuint(t0t) != 0;
if ((t->t_utcknown) && /* got UTC information */
(tlsf != tls) && /* something will change */
=====================================
libparse/parse.c
=====================================
--- a/libparse/parse.c
+++ b/libparse/parse.c
@@ -481,7 +481,7 @@ updatetimeinfo(
parseprintf(DD_PARSE, ("updatetimeinfo status=0x%lx, time=%x\n",
(long)parseio->parse_dtime.parse_state,
- parseio->parse_dtime.parse_time.fp.l_ui));
+ lfpuint(parseio->parse_dtime.parse_time.fp)));
return CVT_OK; /* everything fine and dandy... */
}
=====================================
ntpd/ntp_filegen.c
=====================================
--- a/ntpd/ntp_filegen.c
+++ b/ntpd/ntp_filegen.c
@@ -445,7 +445,7 @@ filegen_config(
*/
if (file_existed) {
get_systime(&now);
- filegen_setup(gen, now.l_ui);
+ filegen_setup(gen, lfpuint(now));
}
}
=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -1136,12 +1136,12 @@ clock_update(
if (leap_vote_ins > leap_vote_del
&& leap_vote_ins > sys_survivors / 2) {
get_systime(&now);
- leapsec_add_dyn(true, now.l_ui, NULL);
+ leapsec_add_dyn(true, lfpuint(now), NULL);
}
if (leap_vote_del > leap_vote_ins
&& leap_vote_del > sys_survivors / 2) {
get_systime(&now);
- leapsec_add_dyn(false, now.l_ui, NULL);
+ leapsec_add_dyn(false, lfpuint(now), NULL);
}
}
break;
=====================================
ntpd/ntp_timer.c
=====================================
--- a/ntpd/ntp_timer.c
+++ b/ntpd/ntp_timer.c
@@ -271,7 +271,7 @@ timer(void)
* is imminent or every 8th second.
*/
if (leapsec > LSPROX_NOWARN || 0 == (current_time & 7))
- check_leapsec(now.l_ui, &tnow,
+ check_leapsec(lfpuint(now), &tnow,
(sys_leap == LEAP_NOTINSYNC));
if (sys_leap != LEAP_NOTINSYNC) {
if (leapsec >= LSPROX_ANNOUNCE && leapdif) {
@@ -314,9 +314,9 @@ timer(void)
write_stats();
if (leapf_timer <= current_time) {
leapf_timer += SECSPERDAY;
- check_leap_file(true, now.l_ui, &tnow);
+ check_leap_file(true, lfpuint(now), &tnow);
} else {
- check_leap_file(false, now.l_ui, &tnow);
+ check_leap_file(false, lfpuint(now), &tnow);
}
}
}
=====================================
ntpd/refclock_nmea.c
=====================================
--- a/ntpd/refclock_nmea.c
+++ b/ntpd/refclock_nmea.c
@@ -925,7 +925,7 @@ nmea_receive(
rc_time = parse_time(&date, &tofs.tv_nsec, &rdata, 1);
pp->leap = parse_qual(&rdata, 2, 'A', 0);
rc_date = parse_date(&date, &rdata, 9, DATE_1_DDMMYY)
- && unfold_century(&date, rd_timestamp.l_ui);
+ && unfold_century(&date, lfpuint(rd_timestamp));
if (CLK_FLAG4 & pp->sloppyclockflag)
field_wipe(&rdata, 3, 4, 5, 6, -1);
break;
@@ -934,7 +934,7 @@ nmea_receive(
/* Check quality byte, fetch time only */
rc_time = parse_time(&date, &tofs.tv_nsec, &rdata, 1);
pp->leap = parse_qual(&rdata, 6, '0', 1);
- rc_date = unfold_day(&date, rd_timestamp.l_ui);
+ rc_date = unfold_day(&date, lfpuint(rd_timestamp));
if (CLK_FLAG4 & pp->sloppyclockflag)
field_wipe(&rdata, 2, 4, -1);
break;
@@ -943,7 +943,7 @@ nmea_receive(
/* Check quality byte, fetch time only */
rc_time = parse_time(&date, &tofs.tv_nsec, &rdata, 5);
pp->leap = parse_qual(&rdata, 6, 'A', 0);
- rc_date = unfold_day(&date, rd_timestamp.l_ui);
+ rc_date = unfold_day(&date, lfpuint(rd_timestamp));
if (CLK_FLAG4 & pp->sloppyclockflag)
field_wipe(&rdata, 1, 3, -1);
break;
@@ -1806,7 +1806,7 @@ eval_gps_time(
/* If we fully trust the GPS receiver, just combine days and
* seconds and be done. */
if (peer->ttl & NMEA_DATETRUST_MASK) {
- retv.l_ui = time64lo(ntpcal_dayjoin(gps_day, gps_sec));
+ setlfpuint(retv, time64lo(ntpcal_dayjoin(gps_day, gps_sec)));
return retv;
}
@@ -1834,7 +1834,7 @@ eval_gps_time(
}
/* - get unfold base: day of full recv time - 512 weeks */
- vi64 = ntpcal_ntp_to_ntp(xrecv->l_ui, NULL);
+ vi64 = ntpcal_ntp_to_ntp(lfpuint(*xrecv), NULL);
rs64 = ntpcal_daysplit(vi64);
rcv_sec = rs64.lo;
rcv_day = rs64.hi - 512 * 7;
@@ -1864,7 +1864,7 @@ eval_gps_time(
}
/* - build result and be done */
- retv.l_ui = time64lo(ntpcal_dayjoin(adj_day, gps_sec));
+ setlfpuint(retv, time64lo(ntpcal_dayjoin(adj_day, gps_sec)));
return retv;
}
=====================================
ntpd/refclock_oncore.c
=====================================
--- a/ntpd/refclock_oncore.c
+++ b/ntpd/refclock_oncore.c
@@ -1694,7 +1694,7 @@ oncore_get_timestamp(
or more simply
dmy = 1.0e-9*tsp->tv_nsec; /* fractional part */
DTOLFP(dmy, &ts);
- ts.l_ui = tsp->tv_sec;
+ setlfpuint(ts, tsp->tv_sec);
#endif /* 0 */
/* now have timestamp in ts */
@@ -1764,7 +1764,7 @@ oncore_get_timestamp(
/* print out information about this timestamp (long line) */
ts_tmp = ts;
- ts_tmp.l_ui = 0; /* zero integer part */
+ setlfpuint(ts_tmp, 0); /* zero integer part */
LFPTOD(&ts_tmp, dmy); /* convert fractional part to a double */
j = 1.0e9*dmy; /* then to integer ns */
@@ -1796,7 +1796,7 @@ oncore_get_timestamp(
}
snprintf(Msg, sizeof(Msg), /* MAX length 128, currently at 127 */
"%u.%09lu %d %d %2d %2d %2d %2ld rstat %02x dop %4.1f nsat %2d,%d traim %d,%s,%s sigma %s neg-sawtooth %s sat %d%d%d%d%d%d%d%d",
- ts.l_ui, j,
+ lfpuint(ts), j,
instance->pp->year, instance->pp->day,
instance->pp->hour, instance->pp->minute, instance->pp->second,
(long) tsp->tv_sec % 60,
@@ -1829,7 +1829,7 @@ oncore_get_timestamp(
}
snprintf(Msg, sizeof(Msg),
"%u.%09lu %d %d %2d %2d %2d %2ld rstat %02x dop %4.1f nsat %2d,%d traim %d,%s,%s sigma %s neg-sawtooth %s sat %d%d%d%d%d%d%d%d%d%d%d%d",
- ts.l_ui, j,
+ lfpuint(ts), j,
instance->pp->year, instance->pp->day,
instance->pp->hour, instance->pp->minute, instance->pp->second,
(long) tsp->tv_sec % 60,
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/62dc25479e2da4483f9ac44257aa8ef0cbae7ea3
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20161225/afa677be/attachment.html>
More information about the vc
mailing list