From 9a09d15bea356cd99605c5ef36dd13ae40a6a721 Mon Sep 17 00:00:00 2001
From: SChernykh <sergey.v.chernykh@gmail.com>
Date: Mon, 21 Feb 2022 18:46:53 +0100
Subject: [PATCH] P2PServer: use high_resolution_clock for ping time

---
 src/p2p_server.cpp | 4 ++--
 src/p2p_server.h   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/p2p_server.cpp b/src/p2p_server.cpp
index 21e9489..dc558e5 100644
--- a/src/p2p_server.cpp
+++ b/src/p2p_server.cpp
@@ -303,7 +303,7 @@ void P2PServer::update_peer_list()
 					});
 
 				if (result) {
-					client->m_lastPeerListRequestTime = std::chrono::system_clock::now();
+					client->m_lastPeerListRequestTime = std::chrono::high_resolution_clock::now();
 					++client->m_peerListPendingRequests;
 				}
 			}
@@ -1255,7 +1255,7 @@ bool P2PServer::P2PClient::on_read(char* data, uint32_t size)
 					bytes_read = 2u + num_peers * 19u;
 
 					using namespace std::chrono;
-					m_pingTime = duration_cast<milliseconds>(system_clock::now() - m_lastPeerListRequestTime).count();
+					m_pingTime = duration_cast<milliseconds>(high_resolution_clock::now() - m_lastPeerListRequestTime).count();
 
 					--m_peerListPendingRequests;
 					if (!on_peer_list_response(buf + 1)) {
diff --git a/src/p2p_server.h b/src/p2p_server.h
index 6afe72f..c6c24f0 100644
--- a/src/p2p_server.h
+++ b/src/p2p_server.h
@@ -112,7 +112,7 @@ public:
 
 		time_t m_prevIncomingPeerListRequest;
 		uint64_t m_nextOutgoingPeerListRequest;
-		std::chrono::system_clock::time_point m_lastPeerListRequestTime;
+		std::chrono::high_resolution_clock::time_point m_lastPeerListRequestTime;
 		int m_peerListPendingRequests;
 		int64_t m_pingTime;