diff options
author | bunnei <bunneidev@gmail.com> | 2019-12-22 23:49:51 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2020-01-04 19:48:29 +0100 |
commit | 78f977c980e125e92b86261335447d0a254f18ee (patch) | |
tree | eca0bcfdcabe32dd737fc545b1ce42395cdad2fc /src/core/hle/service/time/time_zone_manager.h | |
parent | core: Initialize several structs that make use of Common::UUID. (diff) | |
download | yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar.gz yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar.bz2 yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar.lz yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar.xz yuzu-78f977c980e125e92b86261335447d0a254f18ee.tar.zst yuzu-78f977c980e125e92b86261335447d0a254f18ee.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/time/time_zone_manager.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/core/hle/service/time/time_zone_manager.h b/src/core/hle/service/time/time_zone_manager.h new file mode 100644 index 000000000..7c6f975ae --- /dev/null +++ b/src/core/hle/service/time/time_zone_manager.h @@ -0,0 +1,53 @@ +// Copyright 2019 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <string> + +#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/time_zone_types.h" + +namespace Service::Time::TimeZone { + +class TimeZoneManager final { +public: + TimeZoneManager(); + ~TimeZoneManager(); + + void SetTotalLocationNameCount(std::size_t value) { + total_location_name_count = value; + } + + void SetTimeZoneRuleVersion(const u128& value) { + time_zone_rule_version = value; + } + + void MarkAsInitialized() { + is_initialized = true; + } + + ResultCode SetDeviceLocationNameWithTimeZoneRule(const std::string& location_name, + FileSys::VirtualFile& vfs_file); + ResultCode SetUpdatedTime(const Clock::SteadyClockTimePoint& value); + ResultCode GetDeviceLocationName(TimeZone::LocationName& value) const; + ResultCode ToCalendarTime(const TimeZoneRule& rules, s64 time, CalendarInfo& calendar) const; + ResultCode ToCalendarTimeWithMyRules(s64 time, CalendarInfo& calendar) const; + ResultCode ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const; + ResultCode ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time, + s64& posix_time) const; + +private: + bool is_initialized{}; + TimeZoneRule time_zone_rule{}; + std::string device_location_name{"GMT"}; + u128 time_zone_rule_version{}; + std::size_t total_location_name_count{}; + Clock::SteadyClockTimePoint time_zone_update_time_point{ + Clock::SteadyClockTimePoint::GetRandom()}; +}; + +} // namespace Service::Time::TimeZone |