File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ std::chrono::milliseconds DriftCounter::getDrift() const
2525{
2626 auto now = std::chrono::steady_clock::now ();
2727
28- const auto last_update_copy = last_update;
28+ const auto last_update_copy = last_update. value_or ( std::chrono::steady_clock::now ()) ;
2929
3030 if (last_update_copy + (std::chrono::milliseconds (HEARTBEAT_INTERVAL) * 2 ) < now)
3131 return std::chrono::duration_cast<std::chrono::milliseconds>(now - last_update_copy);
Original file line number Diff line number Diff line change 33
44#include < chrono>
55#include < array>
6+ #include < optional>
67
78/* *
89 * @brief The DriftCounter class allows measuring drift in threads.
1213 */
1314class DriftCounter
1415{
15- std::chrono::time_point<std::chrono::steady_clock> last_update = std::chrono::steady_clock::now() ;
16+ std::optional<std:: chrono::time_point<std::chrono::steady_clock>> last_update;
1617 std::chrono::milliseconds last_drift = std::chrono::milliseconds(0 );
1718 std::array<std::chrono::milliseconds, 16 > many_drifts{};
1819 unsigned int many_index = 0 ;
You can’t perform that action at this time.
0 commit comments