Enable gcc-14 builds
gcc-14 enables the std::chrono features we need for doing lots of time
conversions. For whatever reason, std::chrono accepts a an hour of 60,
whereas date.h didn't. This test case is really just a corner case, so
accept either answer.
Tested: Unit tests pass. Good coverage.
Change-Id: I2fb7fcbebb2a4126b36f99d27b216b835d1e2994
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/src/utils/time_utils.cpp b/redfish-core/src/utils/time_utils.cpp
index 2d5e0cc..c33d501 100644
--- a/redfish-core/src/utils/time_utils.cpp
+++ b/redfish-core/src/utils/time_utils.cpp
@@ -1,6 +1,8 @@
#include "utils/time_utils.hpp"
+#if __cpp_lib_chrono < 201907L
#include "utils/extern/date.h"
+#endif
#include <array>
#include <chrono>
diff --git a/test/redfish-core/include/utils/time_utils_test.cpp b/test/redfish-core/include/utils/time_utils_test.cpp
index 882182a..52c8590 100644
--- a/test/redfish-core/include/utils/time_utils_test.cpp
+++ b/test/redfish-core/include/utils/time_utils_test.cpp
@@ -197,7 +197,14 @@
EXPECT_EQ(dateStringToEpoch("2024-07-01TX:00:00Z"), std::nullopt);
// invalid minute (60)
+ // Date.h and std::chrono seem to disagree about whether there is a 60th
+ // minute in an hour. Not clear if this is intended or not, but really
+ // isn't that important. Let std::chrono pass with 61
+#if __cpp_lib_chrono >= 201907L
+ EXPECT_EQ(dateStringToEpoch("2024-07-01T12:61:00Z"), std::nullopt);
+#else
EXPECT_EQ(dateStringToEpoch("2024-07-01T12:60:00Z"), std::nullopt);
+#endif
// invalid character for minute
EXPECT_EQ(dateStringToEpoch("2024-13-01T12:X:00Z"), std::nullopt);