Core/Misc: Added a include hack for msvc <chrono> to use only c++17 bits from it

(cherry picked from commit 585900f42d)
This commit is contained in:
Shauren
2023-01-05 12:16:21 +01:00
parent d0553d499b
commit 73e7f0fe6d
4 changed files with 9 additions and 4 deletions

View File

@@ -20,6 +20,7 @@
#include "AppenderFile.h"
#include "Common.h"
#include "Config.h"
#include "Duration.h"
#include "Errors.h"
#include "Logger.h"
#include "LogMessage.h"
@@ -27,7 +28,6 @@
#include "Strand.h"
#include "StringConvert.h"
#include "Util.h"
#include <chrono>
#include <sstream>
Log::Log() : AppenderId(0), lowestLogLevel(LOG_LEVEL_FATAL), _ioContext(nullptr), _strand(nullptr)

View File

@@ -23,14 +23,15 @@
*/
#include "Define.h"
#include <algorithm>
namespace ByteConverter
{
template<size_t T>
inline void convert(char *val)
{
std::swap(*val, *(val + T - 1));
char tmp = *val;
*val = *(val + T - 1);
*(val + T - 1) = tmp;
convert<T - 2>(val + 1);
}

View File

@@ -18,7 +18,12 @@
#ifndef _DURATION_H_
#define _DURATION_H_
// HACKS TERRITORY
#if __has_include(<__msvc_chrono.hpp>)
#include <__msvc_chrono.hpp> // skip all the formatting/istream/locale/mutex bloat
#else
#include <chrono>
#endif
/// Milliseconds shorthand typedef.
typedef std::chrono::milliseconds Milliseconds;

View File

@@ -22,7 +22,6 @@
#include "Optional.h"
#include "Random.h"
#include <algorithm>
#include <chrono>
#include <functional>
#include <vector>
#include <queue>