From 879d54fad46a65b490bd56a1a8c5b7e4672a347b Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 23 Aug 2024 22:01:08 -0400 Subject: [PATCH] replaced boost::date_time by functions from std --- daemon/I2PControl.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/daemon/I2PControl.cpp b/daemon/I2PControl.cpp index e2ce7be4..fc7f2257 100644 --- a/daemon/I2PControl.cpp +++ b/daemon/I2PControl.cpp @@ -8,14 +8,12 @@ #include #include +#include #include #include // Use global placeholders from boost introduced when local_time.hpp is loaded #define BOOST_BIND_GLOBAL_PLACEHOLDERS - -#include -#include #include #include @@ -258,9 +256,9 @@ namespace client header << "Content-Length: " << boost::lexical_cast(len) << "\r\n"; header << "Content-Type: application/json\r\n"; header << "Date: "; - auto facet = new boost::local_time::local_time_facet ("%a, %d %b %Y %H:%M:%S GMT"); - header.imbue(std::locale (header.getloc(), facet)); - header << boost::posix_time::second_clock::local_time() << "\r\n"; + std::time_t t = std::time (nullptr); + std::tm tm = *std::gmtime (&t); + header << std::put_time(&tm, "%a, %d %b %Y %T GMT") << "\r\n"; header << "\r\n"; offset = header.str ().size (); memcpy (buf->data (), header.str ().c_str (), offset);