time.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <array>
  6. #include "core/hle/service/service.h"
  7. namespace Service::Time {
  8. struct LocationName {
  9. std::array<u8, 0x24> name;
  10. };
  11. static_assert(sizeof(LocationName) == 0x24, "LocationName is incorrect size");
  12. struct CalendarTime {
  13. u16_le year;
  14. u8 month; // Starts at 1
  15. u8 day; // Starts at 1
  16. u8 hour;
  17. u8 minute;
  18. u8 second;
  19. INSERT_PADDING_BYTES(1);
  20. };
  21. static_assert(sizeof(CalendarTime) == 0x8, "CalendarTime structure has incorrect size");
  22. struct CalendarAdditionalInfo {
  23. u32_le day_of_week;
  24. u32_le day_of_year;
  25. std::array<u8, 8> name;
  26. INSERT_PADDING_BYTES(1);
  27. s32_le utc_offset;
  28. };
  29. static_assert(sizeof(CalendarAdditionalInfo) == 0x18,
  30. "CalendarAdditionalInfo structure has incorrect size");
  31. // TODO(mailwl) RE this structure
  32. struct TimeZoneRule {
  33. INSERT_PADDING_BYTES(0x4000);
  34. };
  35. struct SteadyClockTimePoint {
  36. u64_le value;
  37. INSERT_PADDING_WORDS(4);
  38. };
  39. static_assert(sizeof(SteadyClockTimePoint) == 0x18, "SteadyClockTimePoint is incorrect size");
  40. struct SystemClockContext {
  41. u64_le offset;
  42. SteadyClockTimePoint time_point;
  43. };
  44. static_assert(sizeof(SystemClockContext) == 0x20,
  45. "SystemClockContext structure has incorrect size");
  46. class Module final {
  47. public:
  48. class Interface : public ServiceFramework<Interface> {
  49. public:
  50. explicit Interface(std::shared_ptr<Module> time, const char* name);
  51. void GetStandardUserSystemClock(Kernel::HLERequestContext& ctx);
  52. void GetStandardNetworkSystemClock(Kernel::HLERequestContext& ctx);
  53. void GetStandardSteadyClock(Kernel::HLERequestContext& ctx);
  54. void GetTimeZoneService(Kernel::HLERequestContext& ctx);
  55. void GetStandardLocalSystemClock(Kernel::HLERequestContext& ctx);
  56. protected:
  57. std::shared_ptr<Module> time;
  58. };
  59. };
  60. /// Registers all Time services with the specified service manager.
  61. void InstallInterfaces(SM::ServiceManager& service_manager);
  62. } // namespace Service::Time