summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar lat9nq2023-05-21 00:36:58 -0400
committerGravatar lat9nq2023-06-05 15:15:11 -0400
commitc378cbbc2dbd626e8def2c47f52ea21447dd705e (patch)
tree65786e7288fee6da975bfcffc980ec04c6b2a485 /src
parentMerge pull request #10594 from liamwhite/double-patch (diff)
downloadyuzu-c378cbbc2dbd626e8def2c47f52ea21447dd705e.tar.gz
yuzu-c378cbbc2dbd626e8def2c47f52ea21447dd705e.tar.xz
yuzu-c378cbbc2dbd626e8def2c47f52ea21447dd705e.zip
tz_content_manager: Detect system time zone
Uses C++20 tzdb to determine the system timezone. The switch uses the 597 posix time zones, so this needs tests if the system time zone isn't posix-compliant.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/time/time_zone_content_manager.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/hle/service/time/time_zone_content_manager.cpp b/src/core/hle/service/time/time_zone_content_manager.cpp
index afbfe9715..ae41116b6 100644
--- a/src/core/hle/service/time/time_zone_content_manager.cpp
+++ b/src/core/hle/service/time/time_zone_content_manager.cpp
@@ -1,6 +1,7 @@
1// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project 1// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
2// SPDX-License-Identifier: GPL-2.0-or-later 2// SPDX-License-Identifier: GPL-2.0-or-later
3 3
4#include <chrono>
4#include <sstream> 5#include <sstream>
5 6
6#include "common/logging/log.h" 7#include "common/logging/log.h"
@@ -12,7 +13,11 @@
12#include "core/file_sys/registered_cache.h" 13#include "core/file_sys/registered_cache.h"
13#include "core/file_sys/romfs.h" 14#include "core/file_sys/romfs.h"
14#include "core/file_sys/system_archive/system_archive.h" 15#include "core/file_sys/system_archive/system_archive.h"
16#include "core/file_sys/vfs.h"
17#include "core/file_sys/vfs_types.h"
18#include "core/hle/result.h"
15#include "core/hle/service/filesystem/filesystem.h" 19#include "core/hle/service/filesystem/filesystem.h"
20#include "core/hle/service/time/errors.h"
16#include "core/hle/service/time/time_manager.h" 21#include "core/hle/service/time/time_manager.h"
17#include "core/hle/service/time/time_zone_content_manager.h" 22#include "core/hle/service/time/time_zone_content_manager.h"
18 23
@@ -73,7 +78,12 @@ TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
73void TimeZoneContentManager::Initialize(TimeManager& time_manager) { 78void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
74 std::string location_name; 79 std::string location_name;
75 const auto timezone_setting = Settings::GetTimeZoneString(); 80 const auto timezone_setting = Settings::GetTimeZoneString();
76 if (timezone_setting == "auto" || timezone_setting == "default") { 81 if (timezone_setting == "auto") {
82 const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb();
83 const std::chrono::time_zone* current_zone = time_zone_data.current_zone();
84 std::string_view current_zone_name = current_zone->name();
85 location_name = current_zone_name;
86 } else if (timezone_setting == "default") {
77 location_name = Common::TimeZone::GetDefaultTimeZone(); 87 location_name = Common::TimeZone::GetDefaultTimeZone();
78 } else { 88 } else {
79 location_name = timezone_setting; 89 location_name = timezone_setting;