diff options
author | bunnei <bunneidev@gmail.com> | 2020-08-20 00:27:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-20 00:27:49 +0200 |
commit | 354811e5562568ef61f62e3da8e1398ec83faac0 (patch) | |
tree | b182420db4cff61cc83d6e05a7783b0800d434e4 /src/common | |
parent | Merge pull request #4539 from lioncash/disc (diff) | |
parent | Revert "common/time_zone: Simplify GetOsTimeZoneOffset()" (diff) | |
download | yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar.gz yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar.bz2 yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar.lz yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar.xz yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.tar.zst yuzu-354811e5562568ef61f62e3da8e1398ec83faac0.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/time_zone.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/common/time_zone.cpp b/src/common/time_zone.cpp index 7aa1b59ea..ce239eb63 100644 --- a/src/common/time_zone.cpp +++ b/src/common/time_zone.cpp @@ -3,9 +3,8 @@ // Refer to the license.txt file included. #include <chrono> -#include <ctime> - -#include <fmt/chrono.h> +#include <iomanip> +#include <sstream> #include "common/logging/log.h" #include "common/time_zone.h" @@ -17,8 +16,13 @@ std::string GetDefaultTimeZone() { } static std::string GetOsTimeZoneOffset() { - // Get the current timezone offset, e.g. "-400", as a string - return fmt::format("%z", fmt::localtime(std::time(nullptr))); + 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(); } static int ConvertOsTimeZoneOffsetToInt(const std::string& timezone) { |