[Git][NTPsec/ntpsec][master] 3 commits: Tweak for getting started after DNS lookup works.
Hal Murray
gitlab at mg.gitlab.com
Sat May 6 07:48:31 UTC 2017
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
7cd59ba5 by Hal Murray at 2017-05-05T11:37:13-07:00
Tweak for getting started after DNS lookup works.
- - - - -
c84f6eac by Hal Murray at 2017-05-05T23:44:48-07:00
Fix dtolft() on NetBSD, issue 264
- - - - -
2dc1de27 by Hal Murray at 2017-05-05T23:53:24-07:00
Simplify FDF_RoundTrip
- - - - -
3 changed files:
- include/ntp_fp.h
- ntpd/ntp_proto.c
- tests/libntp/lfpfunc.c
Changes:
=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -168,7 +168,11 @@ static inline l_fp dtolfp(double d)
* undefined return if d in NaN
*/
{
- return (l_fp)(llround(ldexp(d, 32)));
+/* Please check issue 264 before changing this to use llround
+ * https://gitlab.com/NTPsec/ntpsec/issues/264
+ * llround is broken on NetBSD, 2017-May-05
+ */
+ return (l_fp)(int64_t)(ldexp(d, 32));
}
static inline double lfptod(l_fp r)
=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -2445,6 +2445,7 @@ if (NULL == server->dstadr)
server->nextdate = current_time;
peer_update_hash(server);
peer_xmit(server);
+ poll_update(server, server->hpoll);
msyslog(LOG_INFO, "Setup server %s", socktoa(rmtadr));
return;
=====================================
tests/libntp/lfpfunc.c
=====================================
--- a/tests/libntp/lfpfunc.c
+++ b/tests/libntp/lfpfunc.c
@@ -239,6 +239,19 @@ TEST(lfpfunc, Absolute) {
return;
}
+static const l_fp roundtab[] = {
+ 0,
+ 0x140000000,
+ 0x1c0000000,
+ 0xffffffff80000000,
+ 0x7fffffff7fffffff,
+ 0x7fffffffffffffff,
+ 0x55555555aaaaaaaa,
+ 0x5555555555555555,
+ 0x8000000000000001
+};
+static const size_t round_cnt = (sizeof(roundtab)/sizeof(roundtab[0]));
+
//----------------------------------------------------------------------
// fp -> double -> fp roundtrip test
@@ -254,16 +267,14 @@ TEST(lfpfunc, FDF_RoundTrip) {
// and checks the difference in the two 'l_fp' values against
// that limit.
- for (idx = 0; idx < addsub_cnt; ++idx) {
- double op2, d;
- l_fp op1 = lfpinit_u(addsub_tab[idx][0].l_ui,
- addsub_tab[idx][0].l_uf);
- op2 = lfptod(op1);
+ for (idx = 0; idx < round_cnt; ++idx) {
+ l_fp op1 = roundtab[idx];
+ double op2 = lfptod(op1);
l_fp op3 = dtolfp(op2);
l_fp temp = op1 - op3;
- d = lfptod(temp);
- /* cast to long unsigned int for 32 bit binaries */
+ double d = lfptod(temp);
+
snprintf(msg, sizeof(msg),
"\nop2: %f op3: %s diff %f not within %e",
op2, mfptoa(op3, 8), d, eps(op2));
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/97615adeb9fe144809643f3d5fd38ed3017b8911...2dc1de27c4e028e4b99db50274d577a2af21e455
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/97615adeb9fe144809643f3d5fd38ed3017b8911...2dc1de27c4e028e4b99db50274d577a2af21e455
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/20170506/cadc9d11/attachment.html>
More information about the vc
mailing list