2018-01-14 18:42:23 -08:00
|
|
|
// Copyright 2018 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-05-31 05:33:30 -07:00
|
|
|
#include <array>
|
2018-01-14 18:42:23 -08:00
|
|
|
#include "core/hle/service/service.h"
|
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
namespace Service::Time {
|
2018-01-14 18:42:23 -08:00
|
|
|
|
2018-01-17 11:33:38 -08:00
|
|
|
struct LocationName {
|
2018-05-31 05:33:30 -07:00
|
|
|
std::array<u8, 0x24> name;
|
2018-01-17 11:33:38 -08:00
|
|
|
};
|
2018-01-17 21:57:11 -08:00
|
|
|
static_assert(sizeof(LocationName) == 0x24, "LocationName is incorrect size");
|
2018-01-17 11:33:38 -08:00
|
|
|
|
|
|
|
struct CalendarTime {
|
|
|
|
u16_le year;
|
|
|
|
u8 month; // Starts at 1
|
|
|
|
u8 day; // Starts at 1
|
|
|
|
u8 hour;
|
|
|
|
u8 minute;
|
|
|
|
u8 second;
|
|
|
|
INSERT_PADDING_BYTES(1);
|
|
|
|
};
|
|
|
|
static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime structure has incorrect size");
|
|
|
|
|
|
|
|
struct CalendarAdditionalInfo {
|
2018-05-31 05:33:30 -07:00
|
|
|
u32_le day_of_week;
|
|
|
|
u32_le day_of_year;
|
|
|
|
std::array<u8, 8> name;
|
|
|
|
INSERT_PADDING_BYTES(1);
|
|
|
|
s32_le utc_offset;
|
2018-01-17 11:33:38 -08:00
|
|
|
};
|
|
|
|
static_assert(sizeof(CalendarAdditionalInfo) == 0x18,
|
|
|
|
"CalendarAdditionalInfo structure has incorrect size");
|
|
|
|
|
2018-05-31 05:33:30 -07:00
|
|
|
// TODO(mailwl) RE this structure
|
|
|
|
struct TimeZoneRule {
|
|
|
|
INSERT_PADDING_BYTES(0x4000);
|
2018-01-23 19:02:14 -08:00
|
|
|
};
|
|
|
|
|
2018-01-24 20:52:21 -08:00
|
|
|
struct SteadyClockTimePoint {
|
2018-05-31 05:33:30 -07:00
|
|
|
u64_le value;
|
2018-01-24 20:52:21 -08:00
|
|
|
INSERT_PADDING_WORDS(4);
|
|
|
|
};
|
|
|
|
static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size");
|
|
|
|
|
2018-05-31 05:33:30 -07:00
|
|
|
struct SystemClockContext {
|
|
|
|
u64_le offset;
|
|
|
|
SteadyClockTimePoint time_point;
|
|
|
|
};
|
|
|
|
static_assert(sizeof(SystemClockContext) == 0x20,
|
|
|
|
"SystemClockContext structure has incorrect size");
|
|
|
|
|
2018-01-18 08:58:29 -08:00
|
|
|
class Module final {
|
2018-01-17 11:33:38 -08:00
|
|
|
public:
|
2018-01-18 08:58:29 -08:00
|
|
|
class Interface : public ServiceFramework<Interface> {
|
|
|
|
public:
|
2018-07-19 09:05:48 -07:00
|
|
|
explicit Interface(std::shared_ptr<Module> time, const char* name);
|
2018-01-18 08:58:29 -08:00
|
|
|
|
|
|
|
void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetStandardSteadyClock(Kernel::HLERequestContext& ctx);
|
|
|
|
void GetTimeZoneService(Kernel::HLERequestContext& ctx);
|
2018-02-21 17:43:05 -08:00
|
|
|
void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx);
|
2018-01-18 08:58:29 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
std::shared_ptr<Module> time;
|
|
|
|
};
|
2018-01-17 11:33:38 -08:00
|
|
|
};
|
|
|
|
|
2018-01-14 18:42:23 -08:00
|
|
|
/// Registers all Time services with the specified service manager.
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager);
|
|
|
|
|
2018-04-19 18:41:44 -07:00
|
|
|
} // namespace Service::Time
|