diff options
author | Lioncash <mathew1800@gmail.com> | 2020-08-15 18:52:35 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2020-08-16 09:58:47 +0200 |
commit | fe97d3415643eb4e542637b7deeff4c5784494f7 (patch) | |
tree | 87da95c1b1ccea2fafa584ea5af07140c97c9743 /src/common | |
parent | Merge pull request #4528 from lioncash/discard (diff) | |
download | yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar.gz yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar.bz2 yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar.lz yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar.xz yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.tar.zst yuzu-fe97d3415643eb4e542637b7deeff4c5784494f7.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/time_zone.cpp | 14 |
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) { |