From 7d26b8c05f63a8a8a62484979a3dd7ffab9e16b6 Mon Sep 17 00:00:00 2001 From: Richard Cohen Date: Tue, 6 Jun 2023 15:42:28 +0100 Subject: [PATCH] Fail the test if still using 32bit time_t in 2038 gtest-gnc-option.cpp and gtest-gnc-optiondb.cpp need to call time() for g_date_set_time_t() --- libgnucash/engine/test/gtest-gnc-option.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libgnucash/engine/test/gtest-gnc-option.cpp b/libgnucash/engine/test/gtest-gnc-option.cpp index 29d6fee316..813820fb1e 100644 --- a/libgnucash/engine/test/gtest-gnc-option.cpp +++ b/libgnucash/engine/test/gtest-gnc-option.cpp @@ -941,6 +941,13 @@ TEST(GncOptionDate, test_gnc_relative_date_from_storage_string) EXPECT_EQ(RelativeDatePeriod::END_ACCOUNTING_PERIOD, gnc_relative_date_from_storage_string("end-prev-fin-year")); } +TEST(GncOptionDate, test_not_using_32bit_time_t_in_2038) +{ + // tests below call time() to initialize GDate. + // make sure the tests fail if that could cause a problem + EXPECT_FALSE(sizeof (time_t) == 4 && time(nullptr) <= 0) << "Time to upgrade 32bit time_t!"; +} + TEST(GncOptionDate, test_gnc_relative_date_to_time64) { GDate date;