time: Remove auto timezone consideration

GetTimeZoneString no longer reports a setting unique to yuzu, so we
can assume a valid timezone string in core.
This commit is contained in:
lat9nq 2023-05-21 15:44:34 -04:00
parent 3e68a284ae
commit a39b9134db
3 changed files with 3 additions and 33 deletions

View file

@ -119,14 +119,6 @@ struct TimeManager::Impl final {
time_zone_content_manager.GetTimeZoneManager().MarkAsInitialized();
}
static s64 GetExternalTimeZoneOffset() {
// With "auto" timezone setting, we use the external system's timezone offset
if (Settings::GetTimeZoneString() == "auto") {
return Common::TimeZone::GetCurrentOffsetSeconds().count();
}
return 0;
}
void SetupStandardSteadyClock(Core::System& system_, Common::UUID clock_source_id,
Clock::TimeSpanType setup_value,
Clock::TimeSpanType internal_offset, bool is_rtc_reset_detected) {
@ -297,13 +289,4 @@ void TimeManager::SetupTimeZoneManager(std::string location_name,
impl->SetupTimeZoneManager(location_name, time_zone_updated_time_point,
total_location_name_count, time_zone_rule_version, vfs_file);
}
/*static*/ s64 TimeManager::GetExternalTimeZoneOffset() {
// With "auto" timezone setting, we use the external system's timezone offset
if (Settings::GetTimeZoneString() == "auto") {
return Common::TimeZone::GetCurrentOffsetSeconds().count();
}
return 0;
}
} // namespace Service::Time

View file

@ -64,8 +64,6 @@ public:
std::size_t total_location_name_count, u128 time_zone_rule_version,
FileSys::VirtualFile& vfs_file);
static s64 GetExternalTimeZoneOffset();
private:
Core::System& system;

View file

@ -76,25 +76,14 @@ TimeZoneContentManager::TimeZoneContentManager(Core::System& system_)
: system{system_}, location_name_cache{BuildLocationNameCache(system)} {}
void TimeZoneContentManager::Initialize(TimeManager& time_manager) {
std::string location_name;
const auto timezone_setting = Settings::GetTimeZoneString();
if (timezone_setting == "auto") {
const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb();
const std::chrono::time_zone* current_zone = time_zone_data.current_zone();
std::string_view current_zone_name = current_zone->name();
location_name = current_zone_name;
} else if (timezone_setting == "default") {
location_name = Common::TimeZone::GetDefaultTimeZone();
} else {
location_name = timezone_setting;
}
if (FileSys::VirtualFile vfs_file;
GetTimeZoneInfoFile(location_name, vfs_file) == ResultSuccess) {
GetTimeZoneInfoFile(timezone_setting, vfs_file) == ResultSuccess) {
const auto time_point{
time_manager.GetStandardSteadyClockCore().GetCurrentTimePoint(system)};
time_manager.SetupTimeZoneManager(location_name, time_point, location_name_cache.size(), {},
vfs_file);
time_manager.SetupTimeZoneManager(timezone_setting, time_point, location_name_cache.size(),
{}, vfs_file);
} else {
time_zone_manager.MarkAsInitialized();
}