Removing getTimestampStr method

The method 'getTimestampStr' is not used elsewhere in the code,
hence it is removed and replaced by 'crow::utility::getDateTime'
method.

Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
Change-Id: I094fe8ca741bf36755a722e72fadd14ed8df7287
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index bee1a92..0707371 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -179,28 +179,6 @@
     return ret;
 }
 
-static bool getTimestampStr(const uint64_t usecSinceEpoch,
-                            std::string& entryTimestamp)
-{
-    time_t t = static_cast<time_t>(usecSinceEpoch / 1000 / 1000);
-    struct tm* loctime = localtime(&t);
-    char entryTime[64] = {};
-    if (nullptr != loctime)
-    {
-        strftime(entryTime, sizeof(entryTime), "%FT%T%z", loctime);
-    }
-    // Insert the ':' into the timezone
-    std::string_view t1(entryTime);
-    std::string_view t2(entryTime);
-    if (t1.size() > 2 && t2.size() > 2)
-    {
-        t1.remove_suffix(2);
-        t2.remove_prefix(t2.size() - 2);
-    }
-    entryTimestamp = std::string(t1) + ":" + std::string(t2);
-    return true;
-}
-
 static bool getEntryTimestamp(sd_journal* journal, std::string& entryTimestamp)
 {
     int ret = 0;
@@ -212,7 +190,9 @@
                          << strerror(-ret);
         return false;
     }
-    return getTimestampStr(timestamp, entryTimestamp);
+    entryTimestamp = crow::utility::getDateTime(
+        static_cast<std::time_t>(timestamp / 1000 / 1000));
+    return true;
 }
 
 static bool getSkipParam(crow::Response& res, const crow::Request& req,
@@ -3201,10 +3181,8 @@
 
         // Get the Created time from the timestamp
         std::string entryTimeStr;
-        if (!getTimestampStr(usecSinceEpoch, entryTimeStr))
-        {
-            continue;
-        }
+        entryTimeStr = crow::utility::getDateTime(
+            static_cast<std::time_t>(usecSinceEpoch / 1000 / 1000));
 
         // assemble messageArgs: BootIndex, TimeOffset(100us), PostCode(hex)
         std::ostringstream hexCode;
@@ -3262,7 +3240,7 @@
             {"MessageArgs", std::move(messageArgs)},
             {"EntryType", "Event"},
             {"Severity", std::move(severity)},
-            {"Created", std::move(entryTimeStr)}};
+            {"Created", entryTimeStr}};
     }
 }