Core/Common: Update PCH content to include most commonly used headers

This commit is contained in:
Shauren
2025-06-11 16:35:31 +02:00
parent 2abf19e832
commit 1ae7cdd512
8 changed files with 28 additions and 38 deletions

View File

@@ -17,14 +17,20 @@
#include "Timezone.h"
#include "Hash.h"
#include "Locales.h"
#include "MapUtils.h"
#include "StringConvert.h"
#include <boost/locale/date_time_facet.hpp>
#include <chrono>
#include <memory>
#include "Tuples.h"
#include <algorithm>
#include <unordered_map>
#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
#include "StringConvert.h"
#else
#include "Locales.h"
#include "Util.h"
#include <boost/locale/date_time_facet.hpp>
#include <memory>
#endif
namespace
{
std::unordered_map<uint32, Minutes, std::identity> InitTimezoneHashDb()
@@ -163,20 +169,13 @@ std::string GetSystemZoneName()
std::string_view FindClosestClientSupportedTimezone(std::string_view currentTimezone, Minutes currentTimezoneOffset)
{
// try exact match
auto itr = std::find_if(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezone](ClientSupportedTimezone const& tz)
{
return tz.second == currentTimezone;
});
auto itr = std::ranges::find(_clientSupportedTimezones, currentTimezone, Trinity::TupleElement<1>);
if (itr != _clientSupportedTimezones.end())
return itr->second;
// try closest offset
itr = std::min_element(_clientSupportedTimezones.begin(), _clientSupportedTimezones.end(), [currentTimezoneOffset](ClientSupportedTimezone const& left, ClientSupportedTimezone const& right)
{
Minutes leftDiff = left.first - currentTimezoneOffset;
Minutes rightDiff = right.first - currentTimezoneOffset;
return std::abs(leftDiff.count()) < std::abs(rightDiff.count());
});
itr = std::ranges::min_element(_clientSupportedTimezones, std::ranges::less(),
[currentTimezoneOffset](ClientSupportedTimezone const& ctz) { return std::chrono::abs(ctz.first - currentTimezoneOffset); });
return itr->second;
}