From: Florian Forster Date: Tue, 8 Dec 2015 09:32:40 +0000 (+0100) Subject: src/daemon/utils_time_test.c: Check the "tv_sec" field of struct time{val,spec}. X-Git-Tag: collectd-5.6.0~512 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=437bd5a9a406f5b07dc58bae612b75f4e6a23a13;p=collectd.git src/daemon/utils_time_test.c: Check the "tv_sec" field of struct time{val,spec}. Also fixes an incorrect "expected" test value. Issue: #1446 --- diff --git a/src/daemon/utils_time_test.c b/src/daemon/utils_time_test.c index 8eac0b62..255286f4 100644 --- a/src/daemon/utils_time_test.c +++ b/src/daemon/utils_time_test.c @@ -62,7 +62,7 @@ DEF_TEST(conversion) // 1546167831554815222 / 2^30 = 1439981005.6712620165... {1546167831554815222ULL, 1439981005.671, 1439981006, 1439981005671ULL, {1439981005, 671262}, {1439981005, 671262017}}, // 1546167986577716567 / 2^30 = 1439981150.0475896215... - {1546167986577716567ULL, 1439981150.048, 1439981150, 1439981150048ULL, {1439981150, 47590}, {1439981005, 47589622}}, + {1546167986577716567ULL, 1439981150.048, 1439981150, 1439981150048ULL, {1439981150, 47590}, {1439981150, 47589622}}, }; size_t i; @@ -78,10 +78,12 @@ DEF_TEST(conversion) // cdtime -> us CDTIME_T_TO_TIMEVAL (cases[i].t, &tv); + EXPECT_EQ_UINT64 (cases[i].tv.tv_sec, tv.tv_sec); EXPECT_EQ_UINT64 (cases[i].tv.tv_usec, tv.tv_usec); // cdtime -> ns CDTIME_T_TO_TIMESPEC (cases[i].t, &ts); + EXPECT_EQ_UINT64 (cases[i].ts.tv_sec, ts.tv_sec); EXPECT_EQ_UINT64 (cases[i].ts.tv_nsec, ts.tv_nsec); // cdtime -> double