mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Movie: Use re-entrant variant of gmtime in GetRTCDisplay()
Makes this member function thread-safe.
This commit is contained in:
@ -7,8 +7,8 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iomanip>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <locale>
|
||||||
#include <mbedtls/config.h>
|
#include <mbedtls/config.h>
|
||||||
#include <mbedtls/md.h>
|
#include <mbedtls/md.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
@ -18,6 +18,7 @@
|
|||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <fmt/chrono.h>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
|
||||||
#include "Common/Assert.h"
|
#include "Common/Assert.h"
|
||||||
@ -166,11 +167,10 @@ std::string MovieManager::GetRTCDisplay()
|
|||||||
|
|
||||||
const time_t current_time =
|
const time_t current_time =
|
||||||
CEXIIPL::GetEmulatedTime(Core::System::GetInstance(), CEXIIPL::UNIX_EPOCH);
|
CEXIIPL::GetEmulatedTime(Core::System::GetInstance(), CEXIIPL::UNIX_EPOCH);
|
||||||
const tm* const gm_time = gmtime(¤t_time);
|
const tm gm_time = fmt::gmtime(current_time);
|
||||||
|
|
||||||
std::ostringstream format_time;
|
// Use current locale for formatting time, as fmt is locale-agnostic by default.
|
||||||
format_time << std::put_time(gm_time, "Date/Time: %c\n");
|
return fmt::format(std::locale{""}, "Date/Time: {:%c}", gm_time);
|
||||||
return format_time.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: GPU Thread
|
// NOTE: GPU Thread
|
||||||
|
Reference in New Issue
Block a user