mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Revert "common/time_zone: Simplify GetOsTimeZoneOffset()"
This commit is contained in:
parent
b1fa647f28
commit
acbae572d3
1 changed files with 9 additions and 5 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue