aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-01-05 12:16:21 +0100
committerShauren <shauren.trinity@gmail.com>2023-01-05 12:16:21 +0100
commit585900f42d064b9f6adc08015605931163ea79c8 (patch)
tree9b723c551bf1f33ed17f189a8f2d4496a0197777 /src
parentd658641764b6d7f058d515aed8a333e3ca0a6e56 (diff)
Core/Misc: Added a include hack for msvc <chrono> to use only c++17 bits from it
Diffstat (limited to 'src')
-rw-r--r--src/common/Logging/Log.cpp2
-rw-r--r--src/common/Utilities/ByteConverter.h5
-rw-r--r--src/common/Utilities/Duration.h5
-rw-r--r--src/common/Utilities/TaskScheduler.h1
4 files changed, 9 insertions, 4 deletions
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index 96056dbc9e3..d0cc289780d 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -19,6 +19,7 @@
#include "AppenderConsole.h"
#include "AppenderFile.h"
#include "Config.h"
+#include "Duration.h"
#include "Errors.h"
#include "Logger.h"
#include "LogMessage.h"
@@ -26,7 +27,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 44267a526b3..b74e61d3db1 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>