// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include #include #include #include #include "core/hle/service/cmif_types.h" #include "core/hle/service/ipc_helpers.h" #include "core/hle/service/psc/time/common.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" namespace Core { class System; } namespace Tz { struct Rule; } namespace Service::Set { class ISystemSettingsServer; } namespace Service::PSC::Time { class TimeZoneService; } namespace Service::Glue::Time { class FileTimestampWorker; class TimeZoneService final : public ServiceFramework { using InRule = InLargeData; using OutRule = OutLargeData; public: explicit TimeZoneService( Core::System& system, FileTimestampWorker& file_timestamp_worker, bool can_write_timezone_device_location, std::shared_ptr time_zone_service); ~TimeZoneService() override; Result GetDeviceLocationName(Out out_location_name); Result SetDeviceLocationName(const Service::PSC::Time::LocationName& location_name); Result GetTotalLocationNameCount(Out out_count); Result LoadLocationNameList( Out out_count, OutArray out_names, u32 index); Result LoadTimeZoneRule(OutRule out_rule, const Service::PSC::Time::LocationName& location_name); Result GetTimeZoneRuleVersion(Out out_rule_version); Result GetDeviceLocationNameAndUpdatedTime( Out location_name, Out out_time_point); Result SetDeviceLocationNameWithTimeZoneRule( const Service::PSC::Time::LocationName& location_name, InBuffer binary); Result ParseTimeZoneBinary(OutRule out_rule, InBuffer binary); Result GetDeviceLocationNameOperationEventReadableHandle( OutCopyHandle out_event); Result ToCalendarTime(Out out_calendar_time, Out out_additional_info, s64 time, InRule rule); Result ToCalendarTimeWithMyRule( Out out_calendar_time, Out out_additional_info, s64 time); Result ToPosixTime(Out out_count, OutArray out_times, const Service::PSC::Time::CalendarTime& calendar_time, InRule rule); Result ToPosixTimeWithMyRule(Out out_count, OutArray out_times, const Service::PSC::Time::CalendarTime& calendar_time); private: Core::System& m_system; std::shared_ptr m_set_sys; bool m_can_write_timezone_device_location; FileTimestampWorker& m_file_timestamp_worker; std::shared_ptr m_wrapped_service; std::mutex m_mutex; bool operation_event_initialized{}; Service::PSC::Time::OperationEvent m_operation_event; }; } // namespace Service::Glue::Time