[ntcore] DispatcherBase::Flush: Use wpi::Now()

This is faster on some platforms than steady_clock, and will more
consistently support simulation timing.
This commit is contained in:
Peter Johnson
2020-12-12 21:13:16 -08:00
parent d85a6d8fe4
commit acfbb1a44a
2 changed files with 5 additions and 5 deletions

View File

@@ -12,6 +12,7 @@
#include <wpi/TCPAcceptor.h>
#include <wpi/TCPConnector.h>
#include <wpi/timestamp.h>
#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;
}