refactor: Use NodeClock::time_point for m_connected

Also, increase the precision to the native one, over prescribing second
precision.
This commit is contained in:
MarcoFalke
2026-03-20 15:52:03 +01:00
parent fa244b984c
commit fa1015bbcb
13 changed files with 57 additions and 57 deletions

View File

@@ -41,7 +41,7 @@ static void EvictionProtection0Networks250Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/250,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_network = NET_IPV4;
});
}
@@ -52,7 +52,7 @@ static void EvictionProtection1Networks250Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/250,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_is_local = false;
if (c.id >= 130 && c.id < 240) { // 110 Tor
c.m_network = NET_ONION;
@@ -68,7 +68,7 @@ static void EvictionProtection2Networks250Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/250,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_is_local = false;
if (c.id >= 90 && c.id < 160) { // 70 Tor
c.m_network = NET_ONION;
@@ -86,7 +86,7 @@ static void EvictionProtection3Networks050Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/50,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_is_local = (c.id == 28 || c.id == 47); // 2 localhost
if (c.id >= 30 && c.id < 47) { // 17 I2P
c.m_network = NET_I2P;
@@ -104,7 +104,7 @@ static void EvictionProtection3Networks100Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/100,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_is_local = (c.id >= 55 && c.id < 60); // 5 localhost
if (c.id >= 70 && c.id < 80) { // 10 I2P
c.m_network = NET_I2P;
@@ -122,7 +122,7 @@ static void EvictionProtection3Networks250Candidates(benchmark::Bench& bench)
bench,
/*num_candidates=*/250,
[](NodeEvictionCandidate& c) {
c.m_connected = std::chrono::seconds{c.id};
c.m_connected = NodeSeconds{std::chrono::seconds{c.id}};
c.m_is_local = (c.id >= 140 && c.id < 160); // 20 localhost
if (c.id >= 170 && c.id < 180) { // 10 I2P
c.m_network = NET_I2P;