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/interfaces/clock.hpp b/src/interfaces/clock.hpp
index 0c355b7..b37ff3a 100644
--- a/src/interfaces/clock.hpp
+++ b/src/interfaces/clock.hpp
@@ -1,5 +1,7 @@
#pragma once
+#include "types/duration_types.hpp"
+
#include <chrono>
namespace interfaces
@@ -8,15 +10,10 @@
class Clock
{
public:
- using duration = std::chrono::steady_clock::time_point::duration;
- using rep = std::chrono::steady_clock::time_point::rep;
- using period = std::chrono::steady_clock::time_point::period;
- using time_point = std::chrono::steady_clock::time_point;
-
virtual ~Clock() = default;
- virtual time_point now() const noexcept = 0;
- virtual uint64_t timestamp() const noexcept = 0;
+ virtual Milliseconds steadyTimestamp() const noexcept = 0;
+ virtual Milliseconds systemTimestamp() const noexcept = 0;
};
} // namespace interfaces