summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/time/time.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-12-22 23:49:51 +0100
committerbunnei <bunneidev@gmail.com>2020-01-04 19:48:29 +0100
commit78f977c980e125e92b86261335447d0a254f18ee (patch)
treeeca0bcfdcabe32dd737fc545b1ce42395cdad2fc /src/core/hle/service/time/time.h
parentcore: Initialize several structs that make use of Common::UUID. (diff)
downloadyuzu-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 'src/core/hle/service/time/time.h')
-rw-r--r--src/core/hle/service/time/time.h100
1 files changed, 24 insertions, 76 deletions
diff --git a/src/core/hle/service/time/time.h b/src/core/hle/service/time/time.h
index c32d32860..7b77ac7ea 100644
--- a/src/core/hle/service/time/time.h
+++ b/src/core/hle/service/time/time.h
@@ -4,102 +4,50 @@
#pragma once
-#include <array>
-#include "common/common_funcs.h"
#include "core/hle/service/service.h"
+#include "core/hle/service/time/clock_types.h"
+#include "core/hle/service/time/time_manager.h"
-namespace Service::Time {
-
-class SharedMemory;
-
-struct LocationName {
- std::array<u8, 0x24> name;
-};
-static_assert(sizeof(LocationName) == 0x24, "LocationName is incorrect size");
-
-struct CalendarTime {
- u16_le year;
- u8 month; // Starts at 1
- u8 day; // Starts at 1
- u8 hour;
- u8 minute;
- u8 second;
-};
-static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime structure has incorrect size");
-
-struct CalendarAdditionalInfo {
- u32_le day_of_week;
- u32_le day_of_year;
- std::array<u8, 8> name;
- u8 is_dst;
- s32_le utc_offset;
-};
-static_assert(sizeof(CalendarAdditionalInfo) == 0x18,
- "CalendarAdditionalInfo structure has incorrect size");
-
-// TODO(mailwl) RE this structure
-struct TimeZoneRule {
- INSERT_PADDING_BYTES(0x4000);
-};
-
-struct SteadyClockTimePoint {
- using SourceID = std::array<u8, 16>;
+namespace Core {
+class System;
+}
- u64_le value;
- SourceID source_id;
-};
-static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size");
-
-struct SystemClockContext {
- u64_le offset;
- SteadyClockTimePoint time_point;
-};
-static_assert(sizeof(SystemClockContext) == 0x20,
- "SystemClockContext structure has incorrect size");
-
-struct ClockSnapshot {
- SystemClockContext user_clock_context;
- SystemClockContext network_clock_context;
- s64_le system_posix_time;
- s64_le network_posix_time;
- CalendarTime system_calendar_time;
- CalendarTime network_calendar_time;
- CalendarAdditionalInfo system_calendar_info;
- CalendarAdditionalInfo network_calendar_info;
- SteadyClockTimePoint steady_clock_timepoint;
- LocationName location_name;
- u8 clock_auto_adjustment_enabled;
- u8 type;
- u8 version;
- INSERT_PADDING_BYTES(1);
-};
-static_assert(sizeof(ClockSnapshot) == 0xd0, "ClockSnapshot is an invalid size");
+namespace Service::Time {
class Module final {
public:
+ Module(Core::System& system) : time_manager{system} {}
+
class Interface : public ServiceFramework<Interface> {
public:
- explicit Interface(std::shared_ptr<Module> time,
- std::shared_ptr<SharedMemory> shared_memory, Core::System& system,
- const char* name);
+ explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name);
~Interface() override;
void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx);
void GetStandardSteadyClock(Kernel::HLERequestContext& ctx);
void GetTimeZoneService(Kernel::HLERequestContext& ctx);
- void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx);
+ void CalculateMonotonicSystemClockBaseTimePoint(Kernel::HLERequestContext& ctx);
void GetClockSnapshot(Kernel::HLERequestContext& ctx);
- void CalculateStandardUserSystemClockDifferenceByUser(Kernel::HLERequestContext& ctx);
void GetSharedMemoryNativeHandle(Kernel::HLERequestContext& ctx);
- void IsStandardUserSystemClockAutomaticCorrectionEnabled(Kernel::HLERequestContext& ctx);
- void SetStandardUserSystemClockAutomaticCorrectionEnabled(Kernel::HLERequestContext& ctx);
+
+ private:
+ ResultCode GetClockSnapshotFromSystemClockContextInternal(
+ Kernel::Thread* thread, Clock::SystemClockContext user_context,
+ Clock::SystemClockContext network_context, u8 type,
+ Clock::ClockSnapshot& cloc_snapshot);
protected:
- std::shared_ptr<Module> time;
- std::shared_ptr<SharedMemory> shared_memory;
+ std::shared_ptr<Module> module;
Core::System& system;
};
+
+ TimeManager& GetTimeManager() {
+ return time_manager;
+ }
+
+private:
+ TimeManager time_manager;
};
/// Registers all Time services with the specified service manager.