From 4966e309388dd1358254e17ec25d4adfd006fcbe Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 7 Sep 2026 22:55:21 -0400 Subject: [PATCH] support C++20 with older boost --- daemon/HTTPServer.cpp | 1 + libi2pd/Destination.h | 1 + libi2pd/NetDb.cpp | 1 + libi2pd/Reseed.cpp | 1 + libi2pd/RouterContext.h | 1 + libi2pd/RouterInfo.h | 1 + libi2pd/Timestamp.cpp | 11 ++++++----- libi2pd/Timestamp.h | 7 ++++--- libi2pd/Transports.h | 1 + libi2pd/util.cpp | 1 + libi2pd_client/HTTPProxy.cpp | 1 + libi2pd_client/SOCKS.h | 1 + 12 files changed, 20 insertions(+), 8 deletions(-) diff --git a/daemon/HTTPServer.cpp b/daemon/HTTPServer.cpp index 410ee86f..6167960b 100644 --- a/daemon/HTTPServer.cpp +++ b/daemon/HTTPServer.cpp @@ -13,6 +13,7 @@ #include #include +#include // for C++20 with boost < 1.81 #include #include diff --git a/libi2pd/Destination.h b/libi2pd/Destination.h index 92f15c66..4e1634fe 100644 --- a/libi2pd/Destination.h +++ b/libi2pd/Destination.h @@ -20,6 +20,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include "Identity.h" #include "TunnelPool.h" diff --git a/libi2pd/NetDb.cpp b/libi2pd/NetDb.cpp index 01fb4aeb..036a0fb5 100644 --- a/libi2pd/NetDb.cpp +++ b/libi2pd/NetDb.cpp @@ -10,6 +10,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include diff --git a/libi2pd/Reseed.cpp b/libi2pd/Reseed.cpp index 5e47b8c5..68ca3a65 100644 --- a/libi2pd/Reseed.cpp +++ b/libi2pd/Reseed.cpp @@ -10,6 +10,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include #include diff --git a/libi2pd/RouterContext.h b/libi2pd/RouterContext.h index efde047b..3e6450cb 100644 --- a/libi2pd/RouterContext.h +++ b/libi2pd/RouterContext.h @@ -13,6 +13,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include "Identity.h" #include "RouterInfo.h" diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index be9cbcce..c67c0d3e 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -18,6 +18,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #ifndef __cpp_lib_atomic_shared_ptr #include diff --git a/libi2pd/Timestamp.cpp b/libi2pd/Timestamp.cpp index edd890b9..fe0a4bd6 100644 --- a/libi2pd/Timestamp.cpp +++ b/libi2pd/Timestamp.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2024, The PurpleI2P Project +* Copyright (c) 2013-2026, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -12,6 +12,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include #include "Config.h" @@ -245,8 +246,8 @@ namespace util { return std::chrono::duration_cast( std::chrono::steady_clock::now().time_since_epoch()).count(); - } - + } + void GetCurrentDate (char * date) { GetDateString (GetSecondsSinceEpoch (), date); @@ -255,8 +256,8 @@ namespace util void GetNextDayDate (char * date) { GetDateString (GetSecondsSinceEpoch () + 24*60*60, date); - } - + } + void GetDateString (uint64_t timestamp, char * date) { using clock = std::chrono::system_clock; diff --git a/libi2pd/Timestamp.h b/libi2pd/Timestamp.h index 6cd50507..3efd7462 100644 --- a/libi2pd/Timestamp.h +++ b/libi2pd/Timestamp.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2025, The PurpleI2P Project +* Copyright (c) 2013-2026, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -13,8 +13,9 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include -#include // for boost 1.89 +#include // for boost 1.89 namespace i2p { @@ -28,7 +29,7 @@ namespace util uint64_t GetMonotonicMicroseconds (); uint64_t GetMonotonicMilliseconds (); uint64_t GetMonotonicSeconds (); - + void GetCurrentDate (char * date); // returns UTC date as YYYYMMDD string, 9 bytes void GetNextDayDate (char * date); // returns next UTC day as YYYYMMDD string, 9 bytes void GetDateString (uint64_t timestamp, char * date); // timestamp is seconds since epoch, returns date as YYYYMMDD string, 9 bytes diff --git a/libi2pd/Transports.h b/libi2pd/Transports.h index 5559edcb..ac3f8f04 100644 --- a/libi2pd/Transports.h +++ b/libi2pd/Transports.h @@ -22,6 +22,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include "TransportSession.h" #include "SSU2.h" diff --git a/libi2pd/util.cpp b/libi2pd/util.cpp index a8f4c226..d618cc0f 100644 --- a/libi2pd/util.cpp +++ b/libi2pd/util.cpp @@ -10,6 +10,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include "util.h" diff --git a/libi2pd_client/HTTPProxy.cpp b/libi2pd_client/HTTPProxy.cpp index 127ae726..265fb5b7 100644 --- a/libi2pd_client/HTTPProxy.cpp +++ b/libi2pd_client/HTTPProxy.cpp @@ -14,6 +14,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include #include diff --git a/libi2pd_client/SOCKS.h b/libi2pd_client/SOCKS.h index 5dbc9356..209b3779 100644 --- a/libi2pd_client/SOCKS.h +++ b/libi2pd_client/SOCKS.h @@ -14,6 +14,7 @@ #include #include #include +#include // for C++20 with boost < 1.81 #include #include #include "I2PService.h"