[Git][NTPsec/ntpsec][master] 3 commits: tests: time_t is not uint32_t.
Gary E. Miller
gitlab at mg.gitlab.com
Tue May 16 21:27:35 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
c8f75f2f by Gary E. Miller at 2017-05-16T14:27:21-07:00
tests: time_t is not uint32_t.
Fixes several warnings on 32-bit RasPi.
- - - - -
8a85a25b by Gary E. Miller at 2017-05-16T14:27:21-07:00
net_fp: remove two unused macros.
- - - - -
7c904c05 by Gary E. Miller at 2017-05-16T14:27:21-07:00
jitter: fix signed, and unsigned, mixup
Fixes warnings on 32-bit RasPi
- - - - -
3 changed files:
- include/ntp_fp.h
- ntpfrob/jitter.c
- tests/ntpd/leapsec.c
Changes:
=====================================
include/ntp_fp.h
=====================================
--- a/include/ntp_fp.h
+++ b/include/ntp_fp.h
@@ -57,14 +57,12 @@
*/
typedef uint64_t l_fp;
#define lfpfrac(n) ((uint32_t)(n))
-#define lfptosint(n) (( int64_t)((uint64_t)(n) << 32))
#define lfptouint(n) ((uint64_t)((uint64_t)(n) << 32))
#define lfpsint(n) (( int32_t)((n) >> 32))
#define lfpuint(n) ((uint32_t)((n) >> 32))
#define bumplfpsint(n, i) ((n) += lfptouint(i))
#define bumplfpuint(n, i) ((n) += lfptouint(i))
#define setlfpfrac(n, v) ((n) = (lfptouint(lfpuint(n)) | lfpfrac(v)))
-#define setlfpsint(n, v) ((n) = (lfptosint(v) | lfpfrac(n)))
#define setlfpuint(n, v) ((n) = (lfptouint(v) | lfpfrac(n)))
static inline l_fp lfpinit(int32_t sec, uint32_t frac)
=====================================
ntpfrob/jitter.c
=====================================
--- a/ntpfrob/jitter.c
+++ b/ntpfrob/jitter.c
@@ -44,7 +44,7 @@ get_clocktime(
* Convert Unix clock from seconds and nanoseconds to seconds.
*/
clock_gettime(CLOCK_REALTIME, &ts);
- *now = lfptouint(ts.tv_sec + JAN_1970); /* no fraction, yet */
+ *now = lfptouint(ts.tv_sec + (long)JAN_1970); /* no fraction, yet */
dtemp = ts.tv_nsec * S_PER_NS;
/*
=====================================
tests/ntpd/leapsec.c
=====================================
--- a/tests/ntpd/leapsec.c
+++ b/tests/ntpd/leapsec.c
@@ -577,14 +577,14 @@ TEST(leapsec, addDynamic) {
bool rc;
int idx;
- static const uint32_t 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
+ static const time_t insns[] = {
+ 2982009600, // 29 # 1 Jul 1994
+ 3029443200, // 30 # 1 Jan 1996
+ 3076704000, // 31 # 1 Jul 1997
+ 3124137600, // 32 # 1 Jan 1999
+ 3345062400, // 33 # 1 Jan 2006
+ 3439756800, // 34 # 1 Jan 2009
+ 3550089600, // 35 # 1 Jul 2012
0 // sentinel
};
@@ -607,16 +607,16 @@ TEST(leapsec, addDynamic) {
// add fixed leap seconds (like from network packet)
TEST(leapsec, addFixed) {
bool rc;
- int idx;
-
- static const struct { uint32_t tt; int of; } insns[] = {
- {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
+ int idx;
+
+ static const struct { time_t tt; int of; } insns[] = {
+ {2982009600-JAN_1970, 29},// # 1 Jul 1994
+ {3029443200-JAN_1970, 30},// # 1 Jan 1996
+ {3076704000-JAN_1970, 31},// # 1 Jul 1997
+ {3124137600-JAN_1970, 32},// # 1 Jan 1999
+ {3345062400-JAN_1970, 33},// # 1 Jan 2006
+ {3439756800-JAN_1970, 34},// # 1 Jan 2009
+ {3550089600-JAN_1970, 35},// # 1 Jul 2012
{0,0} // sentinel
};
@@ -933,9 +933,9 @@ TEST(leapsec, ls2012seqInsDumb) {
TEST(leapsec, lsEmptyTableDumb) {
bool rc;
leap_result_t qr;
- uint32_t t;
- const uint32_t t0 = lsec2012 - 10;
- const uint32_t tE = lsec2012 + 10;
+ time_t t;
+ const time_t t0 = lsec2012 - 10;
+ const time_t tE = lsec2012 + 10;
TEST_ASSERT_FALSE(leapsec_electric(-1));
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/00f74daacca5f41450307c333bbe11f47c5b67d8...7c904c055c3044e2847b89c2b687283bfb67cfda
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/00f74daacca5f41450307c333bbe11f47c5b67d8...7c904c055c3044e2847b89c2b687283bfb67cfda
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/20170516/c605a247/attachment.html>
More information about the vc
mailing list