Capture time stamp for FRU collection

The commit adds code to capture start and end time with respect to VPD
collection of respective FRU.
This information will help in troubleshooting efficiency issue as well
as improving performance in case required.

Change-Id: I91977b981dd6fbed7db565721457f0bb5dc704dd
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
diff --git a/vpd-manager/include/utility/vpd_specific_utility.hpp b/vpd-manager/include/utility/vpd_specific_utility.hpp
index 4dbe488..93fce3f 100644
--- a/vpd-manager/include/utility/vpd_specific_utility.hpp
+++ b/vpd-manager/include/utility/vpd_specific_utility.hpp
@@ -1067,5 +1067,48 @@
             i_fruPath + "]. Error: " + std::string(l_ex.what()));
     }
 }
+
+/**
+ * @brief API to save current time stamp in PIM.
+ *
+ * This API will capture current time stamp and save it in progress interface
+ * for the given inventory path.
+ *
+ * @param[in] i_inventoryPath - Inventory path of FRU.
+ * @param[in] i_property - Property to save the time.
+ */
+inline void saveTimeStampInPim(const std::string& i_inventoryPath,
+                               const std::string& i_property) noexcept
+{
+    if (i_inventoryPath.empty() || i_property.empty())
+    {
+        logging::logMessage("Invalid input parameter. Can't save time in PIM.");
+        return;
+    }
+
+    try
+    {
+        types::ObjectMap l_ObjMap = {std::make_pair(
+            i_inventoryPath,
+            types::InterfaceMap{std::make_pair(
+                constants::vpdCollectionInterface,
+                types::PropertyMap{std::make_pair(
+                    i_property,
+                    types::DbusVariantType{
+                        commonUtility::getCurrentTimeSinceEpoch()})})})};
+
+        if (!dbusUtility::callPIM(move(l_ObjMap)))
+        {
+            logging::logMessage(
+                "Call to PIM failed while saving time for path " +
+                i_inventoryPath);
+        }
+    }
+    catch (const std::exception& l_ex)
+    {
+        logging::logMessage("Failed to save time stamp under PIM for reason: " +
+                            std::string(l_ex.what()));
+    }
+}
 } // namespace vpdSpecificUtility
 } // namespace vpd