From acac2aeb9b6d5426cc6516aa3b0a78539208a5d8 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 6 Jun 2017 20:56:01 -0400 Subject: [PATCH] Movie: Use std::put_time in GetRTCDisplay() No need for a fixed buffer. --- Source/Core/Core/Movie.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Movie.cpp b/Source/Core/Core/Movie.cpp index 608638c39a..8b31b029e7 100644 --- a/Source/Core/Core/Movie.cpp +++ b/Source/Core/Core/Movie.cpp @@ -7,10 +7,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -187,13 +189,13 @@ std::string GetInputDisplay() // NOTE: GPU Thread std::string GetRTCDisplay() { - time_t current_time = - ExpansionInterface::CEXIIPL::GetEmulatedTime(ExpansionInterface::CEXIIPL::UNIX_EPOCH); - tm* gm_time = gmtime(¤t_time); - char buffer[256]; - strftime(buffer, sizeof(buffer), "Date/Time: %c\n", gm_time); + using ExpansionInterface::CEXIIPL; + + const time_t current_time = CEXIIPL::GetEmulatedTime(CEXIIPL::UNIX_EPOCH); + const tm* const gm_time = gmtime(¤t_time); + std::stringstream format_time; - format_time << buffer; + format_time << std::put_time(gm_time, "Date/Time: %c\n"); return format_time.str(); }