summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-17 20:27:02 +0200
committerGitHub <noreply@github.com>2020-08-17 20:27:02 +0200
commit0c885249df93db3262ae6ed2df18ee1cad336723 (patch)
treeae1f6ef67a15f224db53932df70e48faba5fb329 /src/common
parentMerge pull request #4540 from lioncash/tr3 (diff)
parentcommon/time_zone: Simplify GetOsTimeZoneOffset() (diff)
downloadyuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar.gz
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar.bz2
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar.lz
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar.xz
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.tar.zst
yuzu-0c885249df93db3262ae6ed2df18ee1cad336723.zip
Diffstat (limited to '')
-rw-r--r--src/common/time_zone.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/common/time_zone.cpp b/src/common/time_zone.cpp
index ce239eb63..7aa1b59ea 100644
--- a/src/common/time_zone.cpp
+++ b/src/common/time_zone.cpp
@@ -3,8 +3,9 @@
// Refer to the license.txt file included.
#include <chrono>
-#include <iomanip>
-#include <sstream>
+#include <ctime>
+
+#include <fmt/chrono.h>
#include "common/logging/log.h"
#include "common/time_zone.h"
@@ -16,13 +17,8 @@ std::string GetDefaultTimeZone() {
}
static std::string GetOsTimeZoneOffset() {
- const std::time_t t{std::time(nullptr)};
- const std::tm tm{*std::localtime(&t)};
-
- std::stringstream ss;
- ss << std::put_time(&tm, "%z"); // Get the current timezone offset, e.g. "-400", as a string
-
- return ss.str();
+ // Get the current timezone offset, e.g. "-400", as a string
+ return fmt::format("%z", fmt::localtime(std::time(nullptr)));
}
static int ConvertOsTimeZoneOffsetToInt(const std::string& timezone) {