diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-01-05 12:16:21 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-08-12 14:27:25 +0200 |
commit | 73e7f0fe6d5ea2c75ad452effe9d7b95dd323ea2 (patch) | |
tree | 9ecf97ab29113b05a21a4953c8e4952076efbfd9 /src | |
parent | d0553d499b17b5e20640cea5187934ff0bcbc528 (diff) |
Core/Misc: Added a include hack for msvc <chrono> to use only c++17 bits from it
(cherry picked from commit 585900f42d064b9f6adc08015605931163ea79c8)
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Logging/Log.cpp | 2 | ||||
-rw-r--r-- | src/common/Utilities/ByteConverter.h | 5 | ||||
-rw-r--r-- | src/common/Utilities/Duration.h | 5 | ||||
-rw-r--r-- | src/common/Utilities/TaskScheduler.h | 1 |
4 files changed, 9 insertions, 4 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index c4a00af8c9e..96dadcb82c5 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -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) diff --git a/src/common/Utilities/ByteConverter.h b/src/common/Utilities/ByteConverter.h index 59be4adb86b..d9b74b83264 100644 --- a/src/common/Utilities/ByteConverter.h +++ b/src/common/Utilities/ByteConverter.h @@ -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); } diff --git a/src/common/Utilities/Duration.h b/src/common/Utilities/Duration.h index f506467abda..b4c3f17cb3e 100644 --- a/src/common/Utilities/Duration.h +++ b/src/common/Utilities/Duration.h @@ -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; diff --git a/src/common/Utilities/TaskScheduler.h b/src/common/Utilities/TaskScheduler.h index 6bd50cf5b6d..4d6761780be 100644 --- a/src/common/Utilities/TaskScheduler.h +++ b/src/common/Utilities/TaskScheduler.h @@ -22,7 +22,6 @@ #include "Optional.h" #include "Random.h" #include <algorithm> -#include <chrono> #include <functional> #include <vector> #include <queue> |