From 1b8b02a4ab0aae072d0891301d1f9d5376e7912b Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Sun, 8 Jan 2023 12:35:35 -0800 Subject: Simplify datetime parsing This code as it stands pulls in the full datetime library from boost, including io, and a bunch of timezone code. The bmc doesn't make use of any of this, so we can rely on a much simplified version. Unfortunately for us, gcc still doesn't implement the c++20 std::chrono::parse[1]. There is a reference library available from [2] that backports the parse function to compilers that don't yet support it, and is the basis for the libc++ version. This commit opts to copy in the header as-written, under the assumption that we will never need to pull in new versions of this library, and will move to the std ersion as soon as it's available in the next gcc version. This commit simplifies things down to improve compile times and binary size. It saves ~22KB of compressed binary size, or about 3%. Tested: Unit tests pass. Pretty good coverage. [1] https://en.cppreference.com/w/cpp/chrono/parse [2] https://github.com/HowardHinnant/date/blob/master/include/date/date.h Signed-off-by: Ed Tanous Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87 --- test/redfish-core/include/utils/time_utils_test.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/redfish-core/include/utils/time_utils_test.cpp b/test/redfish-core/include/utils/time_utils_test.cpp index 873a385d1e..e88f7580d4 100644 --- a/test/redfish-core/include/utils/time_utils_test.cpp +++ b/test/redfish-core/include/utils/time_utils_test.cpp @@ -166,9 +166,8 @@ TEST(Utility, DateStringToEpoch) usSinceEpoch{253402300799999999}); // Underflow - // Currently gives wrong result - // EXPECT_EQ(dateStringToEpoch("1969-12-30T23:59:59.999999+00:00"), - // std::nullopt); + EXPECT_EQ(dateStringToEpoch("1969-12-30T23:59:59.999999+00:00"), + std::nullopt); } } // namespace -- cgit v1.2.3