From 15d5a9bbd616cb5251a8bec9bb0431202a7fe582 Mon Sep 17 00:00:00 2001 From: SoftCoder Date: Sat, 21 Nov 2015 11:45:52 -0800 Subject: [PATCH] - bug fixes for non C++x11 compilers for using chrono --- data/glest_game | 2 +- .../include/platform/common/platform_common.h | 4 ++-- .../sources/platform/common/platform_common.cpp | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/data/glest_game b/data/glest_game index ad32e03d..bf04854a 160000 --- a/data/glest_game +++ b/data/glest_game @@ -1 +1 @@ -Subproject commit ad32e03df80206332f3438b4008026faa3aac97e +Subproject commit bf04854ade7cd0fc51483c857e590acfef4fbc26 diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index 72b0f550..8313f968 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -25,7 +25,7 @@ #include #include #include -#include +//#include #include "leak_dumper.h" #if (defined WIN32) && !(defined snprintf) @@ -91,7 +91,7 @@ public: virtual void ShellCommandOutput_CallbackEvent(string cmd,char *output,void *userdata) = 0; }; -typedef std::chrono::time_point system_time_point; +//typedef std::chrono::time_point system_time_point; tm threadsafe_localtime(const time_t &time); // extracting std::time_t from std:chrono for "now" time_t systemtime_now(); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index a89f3749..ffeb9f14 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -31,6 +31,12 @@ #endif +#if __cplusplus > 199711L +#include +#else +#include +#endif + #ifdef WIN32 #define S_ISDIR(mode) (((mode) & _S_IFDIR) == _S_IFDIR) #elif defined(__GNUC__) @@ -117,8 +123,12 @@ tm threadsafe_localtime(const time_t &time) { // extracting std::time_t from std:chrono for "now" time_t systemtime_now() { +#if __cplusplus > 199711L system_time_point system_now = std::chrono::system_clock::now(); return std::chrono::system_clock::to_time_t(system_now); +#else + return time(NULL); +#endif }