diff options
author | bunnei <bunneidev@gmail.com> | 2020-01-23 18:04:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-23 18:04:01 +0100 |
commit | a167da4278df6d864a8990f846cf3ede1158f3db (patch) | |
tree | 5991cb8dd907fe439b12fa8dbeb76b39cf857c98 /src/core/hle/service | |
parent | Merge pull request #3338 from ReinUsesLisp/no-fastmath (diff) | |
parent | service: time: Implement ToPosixTimeWithMyRule. (diff) | |
download | yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar.gz yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar.bz2 yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar.lz yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar.xz yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.tar.zst yuzu-a167da4278df6d864a8990f846cf3ede1158f3db.zip |
Diffstat (limited to 'src/core/hle/service')
-rw-r--r-- | src/core/hle/service/time/time_zone_manager.cpp | 9 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_manager.h | 1 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_service.cpp | 24 | ||||
-rw-r--r-- | src/core/hle/service/time/time_zone_service.h | 1 |
4 files changed, 34 insertions, 1 deletions
diff --git a/src/core/hle/service/time/time_zone_manager.cpp b/src/core/hle/service/time/time_zone_manager.cpp index 717e81818..07b553a43 100644 --- a/src/core/hle/service/time/time_zone_manager.cpp +++ b/src/core/hle/service/time/time_zone_manager.cpp @@ -1019,6 +1019,15 @@ ResultCode TimeZoneManager::ToPosixTime(const TimeZoneRule& rules, return RESULT_SUCCESS; } +ResultCode TimeZoneManager::ToPosixTimeWithMyRule(const CalendarTime& calendar_time, + s64& posix_time) const { + if (is_initialized) { + return ToPosixTime(time_zone_rule, calendar_time, posix_time); + } + posix_time = 0; + return ERROR_UNINITIALIZED_CLOCK; +} + ResultCode TimeZoneManager::GetDeviceLocationName(LocationName& value) const { if (!is_initialized) { return ERROR_UNINITIALIZED_CLOCK; diff --git a/src/core/hle/service/time/time_zone_manager.h b/src/core/hle/service/time/time_zone_manager.h index 7c6f975ae..aaab0a1e0 100644 --- a/src/core/hle/service/time/time_zone_manager.h +++ b/src/core/hle/service/time/time_zone_manager.h @@ -39,6 +39,7 @@ public: ResultCode ParseTimeZoneRuleBinary(TimeZoneRule& rules, FileSys::VirtualFile& vfs_file) const; ResultCode ToPosixTime(const TimeZoneRule& rules, const CalendarTime& calendar_time, s64& posix_time) const; + ResultCode ToPosixTimeWithMyRule(const CalendarTime& calendar_time, s64& posix_time) const; private: bool is_initialized{}; diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp index 1566e778e..db57ae069 100644 --- a/src/core/hle/service/time/time_zone_service.cpp +++ b/src/core/hle/service/time/time_zone_service.cpp @@ -22,7 +22,7 @@ ITimeZoneService ::ITimeZoneService(TimeZone::TimeZoneContentManager& time_zone_ {100, &ITimeZoneService::ToCalendarTime, "ToCalendarTime"}, {101, &ITimeZoneService::ToCalendarTimeWithMyRule, "ToCalendarTimeWithMyRule"}, {201, &ITimeZoneService::ToPosixTime, "ToPosixTime"}, - {202, nullptr, "ToPosixTimeWithMyRule"}, + {202, &ITimeZoneService::ToPosixTimeWithMyRule, "ToPosixTimeWithMyRule"}, }; RegisterHandlers(functions); } @@ -145,4 +145,26 @@ void ITimeZoneService::ToPosixTime(Kernel::HLERequestContext& ctx) { ctx.WriteBuffer(&posix_time, sizeof(s64)); } +void ITimeZoneService::ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_Time, "called"); + + IPC::RequestParser rp{ctx}; + const auto calendar_time{rp.PopRaw<TimeZone::CalendarTime>()}; + + s64 posix_time{}; + if (const ResultCode result{ + time_zone_content_manager.GetTimeZoneManager().ToPosixTimeWithMyRule(calendar_time, + posix_time)}; + result != RESULT_SUCCESS) { + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(result); + return; + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(RESULT_SUCCESS); + rb.PushRaw<u32>(1); // Number of times we're returning + ctx.WriteBuffer(&posix_time, sizeof(s64)); +} + } // namespace Service::Time diff --git a/src/core/hle/service/time/time_zone_service.h b/src/core/hle/service/time/time_zone_service.h index a92b4312b..cb495748b 100644 --- a/src/core/hle/service/time/time_zone_service.h +++ b/src/core/hle/service/time/time_zone_service.h @@ -22,6 +22,7 @@ private: void ToCalendarTime(Kernel::HLERequestContext& ctx); void ToCalendarTimeWithMyRule(Kernel::HLERequestContext& ctx); void ToPosixTime(Kernel::HLERequestContext& ctx); + void ToPosixTimeWithMyRule(Kernel::HLERequestContext& ctx); private: TimeZone::TimeZoneContentManager& time_zone_content_manager; |