move constant to new header

create llarp/constants/time.hpp for time/duration constants
This commit is contained in:
Jeff 2022-01-27 11:11:57 -05:00
parent 5fac6c84d8
commit fc444741f1
2 changed files with 11 additions and 1 deletions

10
llarp/constants/time.hpp Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include <chrono>
namespace llarp
{
using namespace std::literals;
/// how big of a time skip before we reset network state
constexpr auto TimeskipDetectedDuration = 1min;
} // namespace llarp

View File

@ -4,6 +4,7 @@
#include <llarp/config/config.hpp>
#include <llarp/constants/proto.hpp>
#include <llarp/constants/files.hpp>
#include <llarp/constants/time.hpp>
#include <llarp/crypto/crypto_libsodium.hpp>
#include <llarp/crypto/crypto.hpp>
#include <llarp/dht/context.hpp>
@ -807,7 +808,6 @@ namespace llarp
return;
// LogDebug("tick router");
const auto now = Now();
constexpr auto TimeskipDetectedDuration = 1min;
if (const auto delta = now - _lastTick; _lastTick != 0s and delta > TimeskipDetectedDuration)
{
// we detected a time skip into the futre, thaw the network