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/numeric_threshold.cpp b/src/numeric_threshold.cpp
index ebb7826..3bec427 100644
--- a/src/numeric_threshold.cpp
+++ b/src/numeric_threshold.cpp
@@ -42,11 +42,11 @@
}
void NumericThreshold::sensorUpdated(interfaces::Sensor& sensor,
- uint64_t timestamp)
+ Milliseconds timestamp)
{}
void NumericThreshold::sensorUpdated(interfaces::Sensor& sensor,
- uint64_t timestamp, double value)
+ Milliseconds timestamp, double value)
{
auto& [sensorName, prevValue, dwell, timer] = getDetails(sensor);
bool decreasing = thresholdValue < prevValue && thresholdValue > value;
@@ -68,8 +68,8 @@
}
void NumericThreshold::startTimer(const std::string& sensorName,
- uint64_t timestamp, double value, bool& dwell,
- boost::asio::steady_timer& timer)
+ Milliseconds timestamp, double value,
+ bool& dwell, boost::asio::steady_timer& timer)
{
if (dwellTime == Milliseconds::zero())
{
@@ -93,8 +93,8 @@
}
}
-void NumericThreshold::commit(const std::string& sensorName, uint64_t timestamp,
- double value)
+void NumericThreshold::commit(const std::string& sensorName,
+ Milliseconds timestamp, double value)
{
for (const auto& action : actions)
{