Populate Timestamp when error entry is committed

Populate the Entry Timestamp property which is
described as the time when the error log entry
is committed in milliseconds since 1970.

Change-Id: Id47fb974cf8220975eef0cc226581d0603a798a9
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/elog_entry.hpp b/elog_entry.hpp
index 92360cb..76e51cf 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -39,11 +39,16 @@
          *         base class) until after the properties are set.
          *  @param[in] bus - Bus to attach to.
          *  @param[in] path - Path to attach at.
-         *  @param[in] properties - Desired Entry properties.
+         *  @param[in] idErr - The error entry id.
+         *  @param[in] timestampErr - The commit timestamp.
+         *  @param[in] severityErr - The severity of the error.
+         *  @param[in] msgErr - The message of the error.
+         *  @param[in] additionalDataErr - The error metadata.
          */
         Entry(sdbusplus::bus::bus& bus,
               const std::string& path,
               uint32_t idErr,
+              uint64_t timestampErr,
               Level severityErr,
               std::string&& msgErr,
               std::vector<std::string>&& additionalDataErr) :
@@ -52,6 +57,7 @@
         {
             id(idErr);
             severity(severityErr);
+            timestamp(timestampErr);
             message(std::move(msgErr));
             additionalData(std::move(additionalDataErr));
 
diff --git a/log_manager.cpp b/log_manager.cpp
index e9f11ec..ef1cae8 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -1,5 +1,6 @@
 #include <fstream>
 #include <iostream>
+#include <chrono>
 #include <cstdio>
 #include <string>
 #include <vector>
@@ -110,12 +111,15 @@
 
     // Create error Entry dbus object
     entryId++;
+    auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
+                std::chrono::system_clock::now().time_since_epoch()).count();
     auto objPath =  std::string(OBJ_ENTRY) + '/' +
-        std::to_string(entryId);
+            std::to_string(entryId);
     entries.insert(std::make_pair(entryId, std::make_unique<Entry>(
             busLog,
             objPath,
             entryId,
+            ms, // Milliseconds since 1970
             (Entry::Level)g_errLevelMap[errMsg],
             std::move(errMsg),
             std::move(additionalData))));