diff options
author | bunnei <bunneidev@gmail.com> | 2019-01-10 23:05:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-10 23:05:21 +0100 |
commit | c9ef8b0af1a5908822ca0f3bb3b2238018a555e8 (patch) | |
tree | 157da486e44b5f7083607159e1bb8bb3e4f20842 /src/core/hle | |
parent | Merge pull request #1939 from DarkLordZach/web-applet (diff) | |
parent | settings: Fix comment structure (diff) | |
download | yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar.gz yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar.bz2 yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar.lz yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar.xz yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.tar.zst yuzu-c9ef8b0af1a5908822ca0f3bb3b2238018a555e8.zip |
Diffstat (limited to 'src/core/hle')
-rw-r--r-- | src/core/hle/service/time/time.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 16564de24..c13640ad8 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -12,9 +12,16 @@ #include "core/hle/kernel/client_session.h" #include "core/hle/service/time/interface.h" #include "core/hle/service/time/time.h" +#include "core/settings.h" namespace Service::Time { +static std::chrono::seconds GetSecondsSinceEpoch() { + return std::chrono::duration_cast<std::chrono::seconds>( + std::chrono::system_clock::now().time_since_epoch()) + + Settings::values.custom_rtc_differential; +} + static void PosixToCalendar(u64 posix_time, CalendarTime& calendar_time, CalendarAdditionalInfo& additional_info, [[maybe_unused]] const TimeZoneRule& /*rule*/) { @@ -68,9 +75,7 @@ public: private: void GetCurrentTime(Kernel::HLERequestContext& ctx) { - const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()) - .count()}; + const s64 time_since_epoch{GetSecondsSinceEpoch().count()}; LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -266,10 +271,7 @@ void Module::Interface::GetClockSnapshot(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto initial_type = rp.PopRaw<u8>(); - const s64 time_since_epoch{std::chrono::duration_cast<std::chrono::seconds>( - std::chrono::system_clock::now().time_since_epoch()) - .count()}; - + const s64 time_since_epoch{GetSecondsSinceEpoch().count()}; const std::time_t time(time_since_epoch); const std::tm* tm = std::localtime(&time); if (tm == nullptr) { |