summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-05-13 00:44:07 +0200
committerbunnei <bunneidev@gmail.com>2020-05-13 00:44:07 +0200
commitbba54e1880bd70d634797052d78359e30ec79acd (patch)
tree27d598aa2ad461f0668702d59abb5d61b3ff5bd0 /src
parenthle: service: time_zone_manager: Use current time zone setting. (diff)
downloadyuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar.gz
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar.bz2
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar.lz
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar.xz
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.tar.zst
yuzu-bba54e1880bd70d634797052d78359e30ec79acd.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/time_zone.cpp4
-rw-r--r--src/common/time_zone.h3
-rw-r--r--src/core/hle/service/time/time_manager.cpp2
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) {
}
}
-int GetCurrentOffsetSeconds() {
+std::chrono::seconds GetCurrentOffsetSeconds() {
const int offset{ConvertOsTimeZoneOffsetToInt(GetOsTimeZoneOffset())};
int seconds{(offset / 100) * 60 * 60}; // Convert hour component to seconds
seconds += (offset % 100) * 60; // Convert minute component to seconds
- return seconds;
+ return std::chrono::seconds{seconds};
}
} // 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 @@
#pragma once
+#include <chrono>
#include <string>
namespace Common::TimeZone {
@@ -12,6 +13,6 @@ namespace Common::TimeZone {
std::string GetDefaultTimeZone();
/// Gets the offset of the current timezone (from the default), in seconds
-int GetCurrentOffsetSeconds();
+std::chrono::seconds GetCurrentOffsetSeconds();
} // 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() {
static s64 GetExternalTimeZoneOffset() {
// With "auto" timezone setting, we use the external system's timezone offset
if (Settings::GetTimeZoneString() == "auto") {
- return Common::TimeZone::GetCurrentOffsetSeconds();
+ return Common::TimeZone::GetCurrentOffsetSeconds().count();
}
return 0;
}