mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-28 09:38:52 +01:00
Changed time display code so it does not require C++11.
This commit is contained in:
parent
064932c46f
commit
382edc61f8
@ -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()
|
||||
|
||||
@ -22,9 +22,7 @@
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
#include <chrono>
|
||||
#include <time.h>
|
||||
|
||||
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")
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user