early-access version 3604
This commit is contained in:
@@ -22,10 +22,6 @@ s64 GetSecondsSinceEpoch() {
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(time_since_epoch).count() +
|
||||
Settings::values.custom_rtc_differential;
|
||||
}
|
||||
|
||||
s64 GetExternalRtcValue() {
|
||||
return GetSecondsSinceEpoch() + TimeManager::GetExternalTimeZoneOffset();
|
||||
}
|
||||
} // Anonymous namespace
|
||||
|
||||
struct TimeManager::Impl final {
|
||||
@@ -43,7 +39,7 @@ struct TimeManager::Impl final {
|
||||
std::make_shared<Clock::EphemeralNetworkSystemClockContextWriter>()},
|
||||
time_zone_content_manager{system} {
|
||||
|
||||
const auto system_time{Clock::TimeSpanType::FromSeconds(GetExternalRtcValue())};
|
||||
const auto system_time{Clock::TimeSpanType::FromSeconds(GetSecondsSinceEpoch())};
|
||||
SetupStandardSteadyClock(system, Common::UUID::MakeRandom(), system_time, {}, {});
|
||||
SetupStandardLocalSystemClock(system, {}, system_time.ToSeconds());
|
||||
|
||||
@@ -123,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) {
|
||||
@@ -301,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
|
||||
|
@@ -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;
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
|
||||
#include "common/logging/log.h"
|
||||
@@ -12,7 +13,11 @@
|
||||
#include "core/file_sys/registered_cache.h"
|
||||
#include "core/file_sys/romfs.h"
|
||||
#include "core/file_sys/system_archive/system_archive.h"
|
||||
#include "core/file_sys/vfs.h"
|
||||
#include "core/file_sys/vfs_types.h"
|
||||
#include "core/hle/result.h"
|
||||
#include "core/hle/service/filesystem/filesystem.h"
|
||||
#include "core/hle/service/time/errors.h"
|
||||
#include "core/hle/service/time/time_manager.h"
|
||||
#include "core/hle/service/time/time_zone_content_manager.h"
|
||||
|
||||
@@ -71,20 +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" || 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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user