Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/tools/helpers/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Timer::Timer(ITimerPool& pool, const char* name)
m_name(name),
m_single_shot(false),
m_interval(std::chrono::milliseconds(0)),
m_wake_up_time_point(std::chrono::time_point<std::chrono::system_clock>::min()),
m_wake_up_time_point(std::chrono::time_point<std::chrono::steady_clock>::min()),
m_started(false),
m_callback()
{
Expand All @@ -57,7 +57,7 @@ bool Timer::start(std::chrono::milliseconds interval, bool single_shot)
// Configure timer
m_interval = interval;
m_single_shot = single_shot;
m_wake_up_time_point = std::chrono::system_clock::now() + m_interval;
m_wake_up_time_point = std::chrono::steady_clock::now() + m_interval;

// Add timer to the list
m_pool.addTimer(this);
Expand Down Expand Up @@ -92,7 +92,7 @@ bool Timer::restart(std::chrono::milliseconds interval, bool single_shot)
// Configure timer
m_interval = interval;
m_single_shot = single_shot;
m_wake_up_time_point = std::chrono::system_clock::now() + m_interval;
m_wake_up_time_point = std::chrono::steady_clock::now() + m_interval;

// Add timer to the list
m_pool.addTimer(this);
Expand Down
2 changes: 1 addition & 1 deletion src/tools/helpers/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class Timer
/** @brief Wake uo interval */
std::chrono::milliseconds m_interval;
/** @brief Next wakeup time point */
std::chrono::time_point<std::chrono::system_clock> m_wake_up_time_point;
std::chrono::time_point<std::chrono::steady_clock> m_wake_up_time_point;
/** @brief Indicate if the timer is started */
bool m_started;
/** @brief Callback */
Expand Down
4 changes: 2 additions & 2 deletions src/tools/helpers/TimerPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ TimerPool::TimerPool()
m_update_wakeup_time(false),
m_wakeup_mutex(),
m_wakeup_cond(),
m_wake_up_time_point(std::chrono::system_clock::now() + std::chrono::hours(2400u)),
m_wake_up_time_point(std::chrono::steady_clock::now() + std::chrono::hours(2400u)),
m_thread(std::bind(&TimerPool::threadLoop, this)),
m_timers(),
m_active_timers()
Expand Down Expand Up @@ -122,7 +122,7 @@ void TimerPool::computeNextWakeupTimepoint()
if (m_active_timers.empty())
{
// Next wakeup in 100days
m_wake_up_time_point = std::chrono::system_clock::now() + std::chrono::hours(2400u);
m_wake_up_time_point = std::chrono::steady_clock::now() + std::chrono::hours(2400u);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/helpers/TimerPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class TimerPool : public ITimerPool
/** @brief Wakeup condition */
std::condition_variable m_wakeup_cond;
/** @brief Next wakeup time point */
std::chrono::time_point<std::chrono::system_clock> m_wake_up_time_point;
std::chrono::time_point<std::chrono::steady_clock> m_wake_up_time_point;
/** @brief Timers thread */
std::thread m_thread;
/** @brief List of registered timers */
Expand Down