summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/time/time_zone_manager.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/time/time_zone_manager.h53
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