From e4a50a3e96aa39346ad7212cae984524276973dd Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Fri, 19 May 2017 12:15:07 +0200 Subject: Added timestamp to received CAN messages and store into frequency_clock_t. Change-Id: If209070298bd9df49297fdcbed554770e1bc0e4a Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/utils/timer.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CAN-binder/low-can-binding/utils/timer.hpp') diff --git a/CAN-binder/low-can-binding/utils/timer.hpp b/CAN-binder/low-can-binding/utils/timer.hpp index 8ea7476..432d513 100644 --- a/CAN-binder/low-can-binding/utils/timer.hpp +++ b/CAN-binder/low-can-binding/utils/timer.hpp @@ -18,6 +18,7 @@ #pragma once #include +#include /// @brief return epoch in milliseconds /// @@ -36,13 +37,13 @@ class frequency_clock_t private: float unit_; ///< unit_ - multiplicator to make operation to be in the right unit (milli, micro, nano, etc) float frequency_; ///< the clock frequency in Hz. - unsigned long last_tick_; ///< the last time (in milliseconds since startup) that the clock ticked. + uint64_t last_tick_; ///< the last time (in microseconds since startup) that the clock ticked. time_function_t time_function_; ///< a function returning current time public: frequency_clock_t(); frequency_clock_t(float frequency); - frequency_clock_t(float frequency, unsigned long last_tick, time_function_t time_function); + frequency_clock_t(float frequency, uint64_t last_tick, time_function_t time_function); float get_frequency() const; const struct timeval get_timeval_from_period() const; @@ -52,5 +53,5 @@ public: time_function_t get_time_function(); bool elapsed(bool stagger); - void tick(); + void tick(uint64_t timestamp); }; \ No newline at end of file -- cgit 1.2.3-korg