Fixed issue with wrong timestamp

Telemetry service used steady_clock for generating timestamps, but it
produced incorrect time. This change makes telemetry service use
steady_clock for intervals and system_clock for timestamps.

Changed readings timestamp to display current timestamp instead of a
time when reading was received.

Tested:
- correct timestamp is visible on dbus
- other telemetry service features are still working

Change-Id: Ic49f45640532cfffaeff5e0bd5591e6d99e5def5
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/src/trigger_actions.cpp b/src/trigger_actions.cpp
index e159cb1..22c81a3 100644
--- a/src/trigger_actions.cpp
+++ b/src/trigger_actions.cpp
@@ -9,9 +9,9 @@
 
 namespace
 {
-std::string timestampToString(uint64_t timestamp)
+std::string timestampToString(Milliseconds timestamp)
 {
-    std::time_t t = static_cast<time_t>(timestamp);
+    std::time_t t = static_cast<time_t>(timestamp.count());
     std::array<char, sizeof("YYYY-MM-DDThh:mm:ssZ")> buf = {};
     size_t size =
         std::strftime(buf.data(), buf.size(), "%FT%TZ", std::gmtime(&t));
@@ -55,7 +55,7 @@
     throw std::runtime_error("Invalid type");
 }
 
-void LogToJournal::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     std::string msg = std::string(getType()) +
@@ -84,14 +84,14 @@
     throw std::runtime_error("Invalid type");
 }
 
-void LogToRedfish::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Threshold value is exceeded",
         phosphor::logging::entry("REDFISH_MESSAGE_ID=%s", getMessageId()),
         phosphor::logging::entry("REDFISH_MESSAGE_ARGS=%s,%f,%llu,%s",
-                                 sensorName.c_str(), value, timestamp,
+                                 sensorName.c_str(), value, timestamp.count(),
                                  getDirection(value, threshold)));
 }
 
@@ -146,7 +146,7 @@
     throw std::runtime_error("Invalid severity");
 }
 
-void LogToJournal::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     std::string msg = std::string(getSeverity()) +
@@ -171,14 +171,14 @@
     throw std::runtime_error("Invalid severity");
 }
 
-void LogToRedfish::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     phosphor::logging::log<phosphor::logging::level::INFO>(
         "Discrete treshold condition is met",
         phosphor::logging::entry("REDFISH_MESSAGE_ID=%s", getMessageId()),
         phosphor::logging::entry("REDFISH_MESSAGE_ARGS=%s,%f,%llu",
-                                 sensorName.c_str(), value, timestamp));
+                                 sensorName.c_str(), value, timestamp.count()));
 }
 
 void fillActions(
@@ -216,7 +216,7 @@
 
 namespace onChange
 {
-void LogToJournal::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToJournal::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     std::string msg = "Value changed on sensor " + sensorName +
@@ -226,7 +226,7 @@
     phosphor::logging::log<phosphor::logging::level::INFO>(msg.c_str());
 }
 
-void LogToRedfish::commit(const std::string& sensorName, uint64_t timestamp,
+void LogToRedfish::commit(const std::string& sensorName, Milliseconds timestamp,
                           double value)
 {
     const char* messageId = "OpenBMC.0.1.0.DiscreteThresholdOnChange";
@@ -234,7 +234,7 @@
         "Uncondtional discrete threshold triggered",
         phosphor::logging::entry("REDFISH_MESSAGE_ID=%s", messageId),
         phosphor::logging::entry("REDFISH_MESSAGE_ARGS=%s,%f,%llu",
-                                 sensorName.c_str(), value, timestamp));
+                                 sensorName.c_str(), value, timestamp.count()));
 }
 
 void fillActions(
@@ -270,7 +270,7 @@
 } // namespace onChange
 } // namespace discrete
 
-void UpdateReport::commit(const std::string&, uint64_t, double)
+void UpdateReport::commit(const std::string&, Milliseconds, double)
 {
     for (const auto& name : reportIds)
     {