diff --git a/ntcore/src/main/native/cpp/Dispatcher.cpp b/ntcore/src/main/native/cpp/Dispatcher.cpp index 560986ca10..c7dbbe6e1d 100644 --- a/ntcore/src/main/native/cpp/Dispatcher.cpp +++ b/ntcore/src/main/native/cpp/Dispatcher.cpp @@ -12,6 +12,7 @@ #include #include +#include #include "IConnectionNotifier.h" #include "IStorage.h" @@ -217,11 +218,11 @@ void DispatcherBase::SetIdentity(const Twine& name) { } void DispatcherBase::Flush() { - auto now = std::chrono::steady_clock::now(); + auto now = wpi::Now(); { std::scoped_lock lock(m_flush_mutex); // don't allow flushes more often than every 5 ms - if ((now - m_last_flush) < std::chrono::milliseconds(5)) return; + if ((now - m_last_flush) < 5000) return; m_last_flush = now; m_do_flush = true; } diff --git a/ntcore/src/main/native/cpp/Dispatcher.h b/ntcore/src/main/native/cpp/Dispatcher.h index bfddae7dfa..f0b100e189 100644 --- a/ntcore/src/main/native/cpp/Dispatcher.h +++ b/ntcore/src/main/native/cpp/Dispatcher.h @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2015-2019 FIRST. All Rights Reserved. */ +/* Copyright (c) 2015-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -9,7 +9,6 @@ #define NTCORE_DISPATCHER_H_ #include -#include #include #include #include @@ -116,7 +115,7 @@ class DispatcherBase : public IDispatcher { // Condition variable for forced dispatch wakeup (flush) wpi::mutex m_flush_mutex; wpi::condition_variable m_flush_cv; - std::chrono::steady_clock::time_point m_last_flush; + uint64_t m_last_flush; bool m_do_flush = false; // Condition variable for client reconnect (uses user mutex)