diff options
Diffstat (limited to '')
| -rw-r--r-- | src/common/time_zone.cpp | 4 | ||||
| -rw-r--r-- | src/common/time_zone.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/time/time_manager.cpp | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/common/time_zone.cpp b/src/common/time_zone.cpp index b902d2d47..ce239eb63 100644 --- a/src/common/time_zone.cpp +++ b/src/common/time_zone.cpp | |||
| @@ -37,13 +37,13 @@ static int ConvertOsTimeZoneOffsetToInt(const std::string& timezone) { | |||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | int GetCurrentOffsetSeconds() { | 40 | std::chrono::seconds GetCurrentOffsetSeconds() { |
| 41 | const int offset{ConvertOsTimeZoneOffsetToInt(GetOsTimeZoneOffset())}; | 41 | const int offset{ConvertOsTimeZoneOffsetToInt(GetOsTimeZoneOffset())}; |
| 42 | 42 | ||
| 43 | int seconds{(offset / 100) * 60 * 60}; // Convert hour component to seconds | 43 | int seconds{(offset / 100) * 60 * 60}; // Convert hour component to seconds |
| 44 | seconds += (offset % 100) * 60; // Convert minute component to seconds | 44 | seconds += (offset % 100) * 60; // Convert minute component to seconds |
| 45 | 45 | ||
| 46 | return seconds; | 46 | return std::chrono::seconds{seconds}; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | } // namespace Common::TimeZone | 49 | } // namespace Common::TimeZone |
diff --git a/src/common/time_zone.h b/src/common/time_zone.h index b7aa1bb10..945daa09c 100644 --- a/src/common/time_zone.h +++ b/src/common/time_zone.h | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <chrono> | ||
| 7 | #include <string> | 8 | #include <string> |
| 8 | 9 | ||
| 9 | namespace Common::TimeZone { | 10 | namespace Common::TimeZone { |
| @@ -12,6 +13,6 @@ namespace Common::TimeZone { | |||
| 12 | std::string GetDefaultTimeZone(); | 13 | std::string GetDefaultTimeZone(); |
| 13 | 14 | ||
| 14 | /// Gets the offset of the current timezone (from the default), in seconds | 15 | /// Gets the offset of the current timezone (from the default), in seconds |
| 15 | int GetCurrentOffsetSeconds(); | 16 | std::chrono::seconds GetCurrentOffsetSeconds(); |
| 16 | 17 | ||
| 17 | } // namespace Common::TimeZone | 18 | } // namespace Common::TimeZone |
diff --git a/src/core/hle/service/time/time_manager.cpp b/src/core/hle/service/time/time_manager.cpp index 54f4a3f04..b4dfe45e5 100644 --- a/src/core/hle/service/time/time_manager.cpp +++ b/src/core/hle/service/time/time_manager.cpp | |||
| @@ -25,7 +25,7 @@ static std::chrono::seconds GetSecondsSinceEpoch() { | |||
| 25 | static s64 GetExternalTimeZoneOffset() { | 25 | static s64 GetExternalTimeZoneOffset() { |
| 26 | // With "auto" timezone setting, we use the external system's timezone offset | 26 | // With "auto" timezone setting, we use the external system's timezone offset |
| 27 | if (Settings::GetTimeZoneString() == "auto") { | 27 | if (Settings::GetTimeZoneString() == "auto") { |
| 28 | return Common::TimeZone::GetCurrentOffsetSeconds(); | 28 | return Common::TimeZone::GetCurrentOffsetSeconds().count(); |
| 29 | } | 29 | } |
| 30 | return 0; | 30 | return 0; |
| 31 | } | 31 | } |