From c419c759177f7d42af4848bc9d16bca3c1644387 Mon Sep 17 00:00:00 2001 From: Ed Tanous Date: Wed, 26 Jan 2022 12:19:54 -0800 Subject: Remove getTimestamp The aforementioned function is only used in the log services, and is used incorrectly in that context. This commit replaces it with the correct (and unit tested) getDateTimeUintMs, which is what we should be using for dbus->time conversions in all cases, to avoid time_t overflows when static casting. Tested: Before "Created": "2022-01-31T19:39:58+00:00", "Modified": "2022-01-31T19:39:58+00:00", With change: "Created": "2022-01-31T19:39:58.101000+00:00", "Modified": "2022-01-31T19:39:58.101000+00:00", The Redfish validator is okay with this *** /redfish/v1/Systems/system/LogServices/EventLog/Entries/1000 Type (LogEntry.v1_8_0.LogEntry), GET SUCCESS (time: 0) PASS Signed-off-by: Ed Tanous Change-Id: Ie8a2243230ee080d9e8785ae918fad1b1b6ab145 --- http/utility.hpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'http/utility.hpp') diff --git a/http/utility.hpp b/http/utility.hpp index 62a4eb0f44..749da9bc51 100644 --- a/http/utility.hpp +++ b/http/utility.hpp @@ -671,15 +671,5 @@ struct ConstantTimeCompare } }; -inline std::time_t getTimestamp(uint64_t millisTimeStamp) -{ - // Retrieve Created property with format: - // yyyy-mm-ddThh:mm:ss - std::chrono::milliseconds chronoTimeStamp(millisTimeStamp); - return std::chrono::duration_cast>( - chronoTimeStamp) - .count(); -} - } // namespace utility } // namespace crow -- cgit v1.2.3