From: Juergen Perlinger Date: Thu, 7 May 2015 21:55:59 +0000 (+0200) Subject: [Bug 2745] ntpd -x steps clock on leap second X-Git-Tag: NTP_4_2_8P3_RC1~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c69a256ee0771f64b8ab2b613ba45d7856a99c29;p=thirdparty%2Fntp.git [Bug 2745] ntpd -x steps clock on leap second provide test case for empty table lookup with real leap second don't step with '-x' or if step min. step > 1sec bk: 554bdf6fipDZo-gvwPskov3bWibvbw --- diff --git a/ChangeLog b/ChangeLog index 76e44110e..15bfe2f2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,5 @@ --- -* [Bug 2745] ntpd -x steps clock on leap second - Do leap second stepping only of the step adjustment is beyond the - proper jump distance limit and step correction is allowed at all. * CID 1295478: Quiet a pedantic potential error from the fix for Bug 2776. * CID 1296235: Fix refclock_jjy.c and correcting type of the driver40-ja.html * CID 1269537: Clean up a line of dead code in getShmTime(). @@ -10,6 +7,9 @@ * [Bug 2612] restrict: Warn when 'monitor' can't be disabled because of 'limited'. * [Bug 2650] fix includefile processing. +* [Bug 2745] ntpd -x steps clock on leap second + Do leap second stepping only of the step adjustment is beyond the + proper jump distance limit and step correction is allowed at all. * [Bug 2776] Improve ntpq's 'help keytype'. * [Bug 2782] Refactor refclock_shm.c, add memory barrier protection. * [Bug 2794] Clean up kernel clock status reports. diff --git a/tests/ntpd/leapsec.cpp b/tests/ntpd/leapsec.cpp index 6ae0cee34..47eb06956 100644 --- a/tests/ntpd/leapsec.cpp +++ b/tests/ntpd/leapsec.cpp @@ -899,3 +899,46 @@ TEST_F(leapsecTest, ls2012seqInsDumb) { EXPECT_EQ(LSPROX_NOWARN, qr.proximity); } +// ---------------------------------------------------------------------- +// test repeated query on empty table in dumb mode +TEST_F(leapsecTest, lsEmptyTableDumb) { + int rc; + leap_result_t qr; + + const time_t pivot(lsec2012); + const uint32_t t0 (lsec2012 - 10); + const uint32_t tE (lsec2012 + 10); + + leapsec_electric(0); + EXPECT_EQ(0, leapsec_electric(-1)); + + leapsec_clear(leapsec_get_table(FALSE)); + for (uint32_t t = t0; t != tE; ++t) { + rc = leapsec_query(&qr, t, &pivot); + EXPECT_EQ(FALSE, rc); + EXPECT_EQ(0, qr.warped ); + EXPECT_EQ(LSPROX_NOWARN, qr.proximity); + } +} + +// ---------------------------------------------------------------------- +// test repeated query on empty table in electric mode +TEST_F(leapsecTest, lsEmptyTableElectric) { + int rc; + leap_result_t qr; + + leapsec_electric(1); + EXPECT_EQ(1, leapsec_electric(-1)); + + const time_t pivot(lsec2012); + const uint32_t t0 (lsec2012 - 10); + const uint32_t tE (lsec2012 + 10); + + leapsec_clear(leapsec_get_table(FALSE)); + for (time_t t = t0; t != tE; ++t) { + rc = leapsec_query(&qr, t, &pivot); + EXPECT_EQ(FALSE, rc); + EXPECT_EQ(0, qr.warped ); + EXPECT_EQ(LSPROX_NOWARN, qr.proximity); + } +}