mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2026-05-01 10:29:28 +02:00
Changed time display code so it does not require C++11.
This commit is contained in:
@@ -214,5 +214,5 @@ if(MSVC)
|
|||||||
set_target_properties(retrofe PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
|
set_target_properties(retrofe PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
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()
|
endif()
|
||||||
|
|||||||
@@ -22,9 +22,7 @@
|
|||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <time.h>
|
||||||
#include <ctime>
|
|
||||||
#include <chrono>
|
|
||||||
|
|
||||||
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY)
|
ReloadableText::ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, float scaleX, float scaleY)
|
||||||
: Component(page)
|
: Component(page)
|
||||||
@@ -116,9 +114,12 @@ void ReloadableText::ReloadTexture()
|
|||||||
std::string text;
|
std::string text;
|
||||||
if (type_ == "time")
|
if (type_ == "time")
|
||||||
{
|
{
|
||||||
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
time_t now = time(0);
|
||||||
std::time_t now_c = std::chrono::system_clock::to_time_t(now);
|
struct tm tstruct;
|
||||||
ss << std::put_time(std::localtime(&now_c), "%r");
|
char buf[80];
|
||||||
|
tstruct = *localtime(&now);
|
||||||
|
strftime(buf, sizeof(buf), "%r", &tstruct);
|
||||||
|
ss << buf;
|
||||||
}
|
}
|
||||||
if (type_ == "numberButtons")
|
if (type_ == "numberButtons")
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user