From 382edc61f8822f9b6861c87173e51a71e54a552f Mon Sep 17 00:00:00 2001 From: Pieter Hulshoff Date: Wed, 1 Jun 2016 10:29:02 +0200 Subject: [PATCH] Changed time display code so it does not require C++11. --- RetroFE/Source/CMakeLists.txt | 2 +- .../Source/Graphics/Component/ReloadableText.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/RetroFE/Source/CMakeLists.txt b/RetroFE/Source/CMakeLists.txt index 546cb3c..3d288bc 100644 --- a/RetroFE/Source/CMakeLists.txt +++ b/RetroFE/Source/CMakeLists.txt @@ -214,5 +214,5 @@ if(MSVC) set_target_properties(retrofe PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS") else() set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") endif() diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp index da4d380..c9c9396 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp @@ -22,9 +22,7 @@ #include #include #include -#include -#include -#include +#include ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY) : Component(page) @@ -116,9 +114,12 @@ void ReloadableText::ReloadTexture() std::string text; if (type_ == "time") { - std::chrono::system_clock::time_point now = std::chrono::system_clock::now(); - std::time_t now_c = std::chrono::system_clock::to_time_t(now); - ss << std::put_time(std::localtime(&now_c), "%r"); + time_t now = time(0); + struct tm tstruct; + char buf[80]; + tstruct = *localtime(&now); + strftime(buf, sizeof(buf), "%r", &tstruct); + ss << buf; } if (type_ == "numberButtons") {