X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=CAN-binder%2Flow-can-binding%2Futils%2Ftimer.hpp;h=560a818155e393ed8d06db00b19efee7d23f224b;hb=7747851ca010a3dfe9ffee808376dd5a7af68b91;hp=8ea747685c3a20520f3824fb246d71a1f6e2611e;hpb=732e212fd2e9c8a69c1ce692fe55af6a8d04f777;p=apps%2Fagl-service-can-low-level.git diff --git a/CAN-binder/low-can-binding/utils/timer.hpp b/CAN-binder/low-can-binding/utils/timer.hpp index 8ea74768..560a8181 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); + explicit frequency_clock_t(float frequency); + 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