time_manager.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. // SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "common/common_types.h"
  5. #include "core/file_sys/vfs_types.h"
  6. #include "core/hle/service/time/clock_types.h"
  7. #include "core/hle/service/time/standard_local_system_clock_core.h"
  8. #include "core/hle/service/time/standard_network_system_clock_core.h"
  9. #include "core/hle/service/time/standard_steady_clock_core.h"
  10. #include "core/hle/service/time/standard_user_system_clock_core.h"
  11. #include "core/hle/service/time/time_sharedmemory.h"
  12. #include "core/hle/service/time/time_zone_content_manager.h"
  13. namespace Service::Time {
  14. namespace Clock {
  15. class EphemeralNetworkSystemClockContextWriter;
  16. class LocalSystemClockContextWriter;
  17. class NetworkSystemClockContextWriter;
  18. } // namespace Clock
  19. // Parts of this implementation were based on Ryujinx (https://github.com/Ryujinx/Ryujinx/pull/783).
  20. // This code was released under public domain.
  21. class TimeManager final {
  22. public:
  23. explicit TimeManager(Core::System& system_);
  24. ~TimeManager();
  25. void Initialize();
  26. Clock::StandardSteadyClockCore& GetStandardSteadyClockCore();
  27. const Clock::StandardSteadyClockCore& GetStandardSteadyClockCore() const;
  28. Clock::StandardLocalSystemClockCore& GetStandardLocalSystemClockCore();
  29. const Clock::StandardLocalSystemClockCore& GetStandardLocalSystemClockCore() const;
  30. Clock::StandardNetworkSystemClockCore& GetStandardNetworkSystemClockCore();
  31. const Clock::StandardNetworkSystemClockCore& GetStandardNetworkSystemClockCore() const;
  32. Clock::StandardUserSystemClockCore& GetStandardUserSystemClockCore();
  33. const Clock::StandardUserSystemClockCore& GetStandardUserSystemClockCore() const;
  34. TimeZone::TimeZoneContentManager& GetTimeZoneContentManager();
  35. const TimeZone::TimeZoneContentManager& GetTimeZoneContentManager() const;
  36. void UpdateLocalSystemClockTime(s64 posix_time);
  37. SharedMemory& GetSharedMemory();
  38. const SharedMemory& GetSharedMemory() const;
  39. void Shutdown();
  40. void SetupTimeZoneManager(std::string location_name,
  41. Clock::SteadyClockTimePoint time_zone_updated_time_point,
  42. std::size_t total_location_name_count, u128 time_zone_rule_version,
  43. FileSys::VirtualFile& vfs_file);
  44. private:
  45. Core::System& system;
  46. struct Impl;
  47. std::unique_ptr<Impl> impl;
  48. };
  49. } // namespace Service::Time