summaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils/timer.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-19 12:15:07 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-19 16:19:08 +0200
commite4a50a3e96aa39346ad7212cae984524276973dd (patch)
tree8a8ba1e7c4db73c5c94d025e0364e1fef87c04c6 /CAN-binder/low-can-binding/utils/timer.hpp
parent7bde3f53dbbbf688506a32e89c27c8aa69a86a3f (diff)
Added timestamp to received CAN messages
and store into frequency_clock_t. Change-Id: If209070298bd9df49297fdcbed554770e1bc0e4a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils/timer.hpp')
-rw-r--r--CAN-binder/low-can-binding/utils/timer.hpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/CAN-binder/low-can-binding/utils/timer.hpp b/CAN-binder/low-can-binding/utils/timer.hpp
index 8ea74768..432d513d 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 <sys/time.h>
+#include <stdint.h>
/// @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