c-jimenez/open-ocpp

replace system_clock with steady_clock?

ruudvd opened this issue · 2 comments

ruudvd commented

Currently in Timer/TimerPool std::system_clock is used for triggering timers. In our testing we got a high CPU usage if the time synchronization is later then the application is started. The initial std::system_clock time point was before the time synchronization took place. After system time does get synchronized, the time jumps forward multiple years, leading to constant triggering of the timers. Using std::steady_clock resolves this issue. Can std::steady_clock be used in the implementation instead of std::system_clock, or is there a reason why std::system_clock is used?

Hi,
Yes this is a good point.
A first I used std::system_clock because I wanted to add a wakeup function on a specific date and time to use to wait for firmware download date and time.
But since I used a different approach for this use case, the timers implementation can now be switched to std::steady_clock.

Fixed with #143