replaced boost::date_time by functions from std

This commit is contained in:
orignal 2024-08-23 22:01:08 -04:00
parent ff5c76f8f2
commit 879d54fad4

View File

@ -8,14 +8,12 @@
#include <stdio.h> #include <stdio.h>
#include <sstream> #include <sstream>
#include <iomanip>
#include <openssl/x509.h> #include <openssl/x509.h>
#include <openssl/pem.h> #include <openssl/pem.h>
// Use global placeholders from boost introduced when local_time.hpp is loaded // Use global placeholders from boost introduced when local_time.hpp is loaded
#define BOOST_BIND_GLOBAL_PLACEHOLDERS #define BOOST_BIND_GLOBAL_PLACEHOLDERS
#include <boost/date_time/local_time/local_time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/json_parser.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
@ -258,9 +256,9 @@ namespace client
header << "Content-Length: " << boost::lexical_cast<std::string>(len) << "\r\n"; header << "Content-Length: " << boost::lexical_cast<std::string>(len) << "\r\n";
header << "Content-Type: application/json\r\n"; header << "Content-Type: application/json\r\n";
header << "Date: "; header << "Date: ";
auto facet = new boost::local_time::local_time_facet ("%a, %d %b %Y %H:%M:%S GMT"); std::time_t t = std::time (nullptr);
header.imbue(std::locale (header.getloc(), facet)); std::tm tm = *std::gmtime (&t);
header << boost::posix_time::second_clock::local_time() << "\r\n"; header << std::put_time(&tm, "%a, %d %b %Y %T GMT") << "\r\n";
header << "\r\n"; header << "\r\n";
offset = header.str ().size (); offset = header.str ().size ();
memcpy (buf->data (), header.str ().c_str (), offset); memcpy (buf->data (), header.str ().c_str (), offset);