diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-12-28 19:09:57 -0500 |
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2019-01-07 19:19:40 -0500 |
| commit | 921ea45baf8539c415aab8d4753e459372ef9fc9 (patch) | |
| tree | c180635840adf9d1555262bf68d223bcd78fb691 /src/core/hle/service/time/time.cpp | |
| parent | 686e0ad7d05574864cb47d914d98c72a4a6c86d0 (diff) | |
time: Use custom RTC settings if applicable for game
Diffstat (limited to 'src/core/hle/service/time/time.cpp')
| -rw-r--r-- | src/core/hle/service/time/time.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/core/hle/service/time/time.cpp b/src/core/hle/service/time/time.cpp index 16564de241..ef8c9f2b77 100644 --- a/src/core/hle/service/time/time.cpp +++ b/src/core/hle/service/time/time.cpp @@ -12,9 +12,17 @@ #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 s64 GetSecondsSinceEpoch() { + return std::chrono::duration_cast<std::chrono::seconds>( + std::chrono::system_clock::now().time_since_epoch()) + .count() + + Settings::values.custom_rtc_differential; +} + static void PosixToCalendar(u64 posix_time, CalendarTime& calendar_time, CalendarAdditionalInfo& additional_info, [[maybe_unused]] const TimeZoneRule& /*rule*/) { @@ -68,9 +76,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()}; LOG_DEBUG(Service_Time, "called"); IPC::ResponseBuilder rb{ctx, 4}; @@ -266,9 +272,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()}; const std::time_t time(time_since_epoch); const std::tm* tm = std::localtime(&time); |
