2019-12-22 23:49:51 +01:00
|
|
|
// Copyright 2019 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/common_types.h"
|
|
|
|
#include "core/file_sys/vfs_types.h"
|
|
|
|
#include "core/hle/service/time/clock_types.h"
|
|
|
|
#include "core/hle/service/time/standard_local_system_clock_core.h"
|
|
|
|
#include "core/hle/service/time/standard_network_system_clock_core.h"
|
|
|
|
#include "core/hle/service/time/standard_steady_clock_core.h"
|
|
|
|
#include "core/hle/service/time/standard_user_system_clock_core.h"
|
|
|
|
#include "core/hle/service/time/time_sharedmemory.h"
|
|
|
|
#include "core/hle/service/time/time_zone_content_manager.h"
|
|
|
|
|
|
|
|
namespace Service::Time {
|
|
|
|
|
|
|
|
namespace Clock {
|
|
|
|
class EphemeralNetworkSystemClockContextWriter;
|
|
|
|
class LocalSystemClockContextWriter;
|
|
|
|
class NetworkSystemClockContextWriter;
|
|
|
|
} // namespace Clock
|
|
|
|
|
|
|
|
// Parts of this implementation were based on Ryujinx (https://github.com/Ryujinx/Ryujinx/pull/783).
|
|
|
|
// This code was released under public domain.
|
|
|
|
|
|
|
|
class TimeManager final {
|
|
|
|
public:
|
2021-05-16 07:46:30 +02:00
|
|
|
explicit TimeManager(Core::System& system_);
|
2019-12-22 23:49:51 +01:00
|
|
|
~TimeManager();
|
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
void Initialize();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
Clock::StandardSteadyClockCore& GetStandardSteadyClockCore();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
const Clock::StandardSteadyClockCore& GetStandardSteadyClockCore() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
Clock::StandardLocalSystemClockCore& GetStandardLocalSystemClockCore();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
const Clock::StandardLocalSystemClockCore& GetStandardLocalSystemClockCore() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
Clock::StandardNetworkSystemClockCore& GetStandardNetworkSystemClockCore();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
const Clock::StandardNetworkSystemClockCore& GetStandardNetworkSystemClockCore() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
Clock::StandardUserSystemClockCore& GetStandardUserSystemClockCore();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
const Clock::StandardUserSystemClockCore& GetStandardUserSystemClockCore() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
TimeZone::TimeZoneContentManager& GetTimeZoneContentManager();
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
const TimeZone::TimeZoneContentManager& GetTimeZoneContentManager() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
void UpdateLocalSystemClockTime(s64 posix_time);
|
|
|
|
|
|
|
|
SharedMemory& GetSharedMemory();
|
|
|
|
|
|
|
|
const SharedMemory& GetSharedMemory() const;
|
2019-12-22 23:49:51 +01:00
|
|
|
|
2021-02-21 02:51:11 +01:00
|
|
|
void Shutdown();
|
|
|
|
|
2019-12-22 23:49:51 +01:00
|
|
|
void SetupTimeZoneManager(std::string location_name,
|
|
|
|
Clock::SteadyClockTimePoint time_zone_updated_time_point,
|
|
|
|
std::size_t total_location_name_count, u128 time_zone_rule_version,
|
|
|
|
FileSys::VirtualFile& vfs_file);
|
|
|
|
|
2020-10-13 03:09:15 +02:00
|
|
|
static s64 GetExternalTimeZoneOffset();
|
|
|
|
|
2019-12-22 23:49:51 +01:00
|
|
|
private:
|
2020-10-13 03:09:15 +02:00
|
|
|
Core::System& system;
|
|
|
|
|
|
|
|
struct Impl;
|
|
|
|
std::unique_ptr<Impl> impl;
|
2019-12-22 23:49:51 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Service::Time
|