From 3a233efe8a56454498a1404ed2ab30e4d5dff52d Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Thu, 27 Aug 2015 00:20:12 +0200 Subject: [PATCH] src/daemon/utils_time_test.c: add ULL suffix to large literals This should prevent some 32bit compilers from complaining about: `integer constant is too large for 'long' type` --- src/daemon/utils_time_test.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/daemon/utils_time_test.c b/src/daemon/utils_time_test.c index 71d2c653..8eac0b62 100644 --- a/src/daemon/utils_time_test.c +++ b/src/daemon/utils_time_test.c @@ -41,28 +41,28 @@ DEF_TEST(conversion) struct timespec ts; } cases[] = { /* cdtime double time_t milliseconds timeval timespec */ - { 0, 0.0 , 0, 0, { 0, 0}, { 0, 0}}, - { 10737418240, 10.0 , 10, 10000, { 10, 0}, { 10, 0}}, - {1542908534771941376, 1436945549.0 , 1436945549, 1436945549000, {1436945549, 0}, {1436945549, 0}}, - {1542908535540740522, 1436945549.716, 1436945550, 1436945549716, {1436945549, 716000}, {1436945549, 716000000}}, + { 0, 0.0 , 0, 0, { 0, 0}, { 0, 0}}, + { 10737418240ULL, 10.0 , 10, 10000, { 10, 0}, { 10, 0}}, + {1542908534771941376ULL, 1436945549.0 , 1436945549, 1436945549000ULL, {1436945549, 0}, {1436945549, 0}}, + {1542908535540740522ULL, 1436945549.716, 1436945550, 1436945549716ULL, {1436945549, 716000}, {1436945549, 716000000}}, // 1426076671.123 * 2^30 = 1531238166015458148.352 - {1531238166015458148, 1426076671.123, 1426076671, 1426076671123, {1426076671, 123000}, {1426076671, 123000000}}, + {1531238166015458148ULL, 1426076671.123, 1426076671, 1426076671123ULL, {1426076671, 123000}, {1426076671, 123000000}}, // 1426076681.234 * 2^30 = 1531238176872061730.816 - {1531238176872061731, 1426076681.234, 1426076681, 1426076681234, {1426076681, 234000}, {1426076681, 234000000}}, + {1531238176872061731ULL, 1426076681.234, 1426076681, 1426076681234ULL, {1426076681, 234000}, {1426076681, 234000000}}, // 1426083986.314 * 2^30 = 1531246020641985396.736 - {1531246020641985397, 1426083986.314, 1426083986, 1426083986314, {1426083986, 314000}, {1426083986, 314000000}}, + {1531246020641985397ULL, 1426083986.314, 1426083986, 1426083986314ULL, {1426083986, 314000}, {1426083986, 314000000}}, // 1426083986.494142531 * 2^30 = 1531246020835411966.5 - {1531246020835411967, 1426083986.494, 1426083986, 1426083986494, {1426083986, 494143}, {1426083986, 494142531}}, + {1531246020835411967ULL, 1426083986.494, 1426083986, 1426083986494ULL, {1426083986, 494143}, {1426083986, 494142531}}, // 1426083986.987410814 * 2^30 = 1531246021365054752.4 - {1531246021365054752, 1426083986.987, 1426083987, 1426083986987, {1426083986, 987411}, {1426083986, 987410814}}, + {1531246021365054752ULL, 1426083986.987, 1426083987, 1426083986987ULL, {1426083986, 987411}, {1426083986, 987410814}}, /* These cases test the cdtime_t -> ns conversion rounds correctly. */ // 1546167635576736987 / 2^30 = 1439980823.1524536265... - {1546167635576736987, 1439980823.152, 1439980823, 1439980823152, {1439980823, 152454}, {1439980823, 152453627}}, + {1546167635576736987ULL, 1439980823.152, 1439980823, 1439980823152ULL, {1439980823, 152454}, {1439980823, 152453627}}, // 1546167831554815222 / 2^30 = 1439981005.6712620165... - {1546167831554815222, 1439981005.671, 1439981006, 1439981005671, {1439981005, 671262}, {1439981005, 671262017}}, + {1546167831554815222ULL, 1439981005.671, 1439981006, 1439981005671ULL, {1439981005, 671262}, {1439981005, 671262017}}, // 1546167986577716567 / 2^30 = 1439981150.0475896215... - {1546167986577716567, 1439981150.048, 1439981150, 1439981150048, {1439981150, 47590}, {1439981005, 47589622}}, + {1546167986577716567ULL, 1439981150.048, 1439981150, 1439981150048ULL, {1439981150, 47590}, {1439981005, 47589622}}, }; size_t i; @@ -99,11 +99,11 @@ DEF_TEST(ns_to_cdtime) cdtime_t want; } cases[] = { // 1439981652801860766 * 2^30 / 10^9 = 1546168526406004689.4 - {1439981652801860766, 1546168526406004689}, + {1439981652801860766ULL, 1546168526406004689ULL}, // 1439981836985281914 * 2^30 / 10^9 = 1546168724171447263.4 - {1439981836985281914, 1546168724171447263}, + {1439981836985281914ULL, 1546168724171447263ULL}, // 1439981880053705608 * 2^30 / 10^9 = 1546168770415815077.4 - {1439981880053705608, 1546168770415815077}, + {1439981880053705608ULL, 1546168770415815077ULL}, }; size_t i; -- 2.30.2