From 1ae7cdd512a28a973aaa087f4516baca1cae665b Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 11 Jun 2025 16:35:31 +0200 Subject: Core/Common: Update PCH content to include most commonly used headers --- src/common/Time/Timezone.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'src/common/Time/Timezone.cpp') diff --git a/src/common/Time/Timezone.cpp b/src/common/Time/Timezone.cpp index 5cd80d03232..6c9e58e0c93 100644 --- a/src/common/Time/Timezone.cpp +++ b/src/common/Time/Timezone.cpp @@ -17,13 +17,19 @@ #include "Timezone.h" #include "Hash.h" -#include "Locales.h" #include "MapUtils.h" +#include "Tuples.h" +#include +#include + +#if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS #include "StringConvert.h" +#else +#include "Locales.h" +#include "Util.h" #include -#include #include -#include +#endif namespace { @@ -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; } -- cgit v1.2.3