summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2023-01-08 23:35:35 +0300
committerEd Tanous <ed@tanous.net>2023-09-08 01:19:57 +0300
commit1b8b02a4ab0aae072d0891301d1f9d5376e7912b (patch)
tree921c52bac6313edf1570122b1a88f579745b1d6b /test
parent77eb0153a21d5b9c6b3e705ecce7b6f9f8bf3075 (diff)
downloadbmcweb-1b8b02a4ab0aae072d0891301d1f9d5376e7912b.tar.xz
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 <edtanous@google.com> Change-Id: I706b91cc3d9df3f32068125bc47ff0c374eb8d87
Diffstat (limited to 'test')
-rw-r--r--test/redfish-core/include/utils/time_utils_test.cpp5
1 files changed, 2 insertions, 3 deletions
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