Read CV_CXX11 for C++11 detection

This commit is contained in:
Rong Mantle Bao
2022-07-10 17:34:07 +08:00
parent db70676933
commit fa613e393f
+3 -10
View File
@@ -301,14 +301,7 @@ DECLARE_CV_CPUID_X86
#endif
#endif
#if ((__cplusplus >= 201103L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
#define HAVE_CXX11 1
#else
#define HAVE_CXX11 0
#endif
#if HAVE_CXX11
#if defined CV_CXX11
#include <chrono>
#endif
@@ -850,7 +843,7 @@ bool useOptimized(void)
int64 getTickCount(void)
{
#if HAVE_CXX11
#if defined CV_CXX11
std::chrono::steady_clock::time_point now = std::chrono::steady_clock::now();
return (int64)now.time_since_epoch().count();
#elif defined _WIN32 || defined WINCE
@@ -872,7 +865,7 @@ int64 getTickCount(void)
double getTickFrequency(void)
{
#if HAVE_CXX11
#if defined CV_CXX11
using clock_period_t = std::chrono::steady_clock::duration::period;
double clock_freq = clock_period_t::den / clock_period_t::num;
return clock_freq;