summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2021-12-27 12:08:57 +0100
committerRoland Reichwein <mail@reichwein.it>2021-12-27 12:08:57 +0100
commit16fbb700ed82cf6d3aad3a9c293b0e8068840b96 (patch)
tree83e54e80a4540199d5f7cc3212470d489f819cbd /src
parentfcdf5b3f2308555f5c1a5b2585ee2947855e1ca9 (diff)
Fix build on Debian and Ubuntu versions
Diffstat (limited to 'src')
-rw-r--r--src/test-unicode.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/test-unicode.cpp b/src/test-unicode.cpp
index e7dfa6f..2675989 100644
--- a/src/test-unicode.cpp
+++ b/src/test-unicode.cpp
@@ -5,7 +5,11 @@
#include <boost/test/data/dataset.hpp>
#include <boost/test/data/monomorphic.hpp>
#include <boost/test/data/test_case.hpp>
+#include <boost/version.hpp>
+#if BOOST_VERSION > 106700
+// CPU Timer in Debian 10 boost is broken, so leave it to std::chrono wall clock
#include <boost/timer/timer.hpp>
+#endif
#include <array>
#include <chrono>
@@ -99,6 +103,10 @@ namespace std {
return os;
}
+} // namespace std
+
+namespace {
+
// utility wrapper to adapt locale-bound facets for wstring/wbuffer convert
template<class Facet>
struct deletable_facet : Facet
@@ -174,7 +182,8 @@ namespace std {
{
return conv32.from_bytes(conv32.to_bytes(s));
}
-}
+
+} // namespace
// check assumptions about environment
BOOST_AUTO_TEST_CASE(string_u8string)
@@ -530,16 +539,23 @@ public:
~CPUTimer()
{
+#if BOOST_VERSION > 106700
auto elapsed_cpu{mCPUTimer.elapsed()};
+#endif
std::cout << mName << ": " << std::chrono::duration<double>(std::chrono::steady_clock::now() - mWallTime0).count() <<
- "s (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) <<
- "s CPU)" << std::endl;
+ "s" <<
+#if BOOST_VERSION > 106700
+ " (" << (double(elapsed_cpu.user + elapsed_cpu.system) / 1000000000) << "s CPU)" <<
+#endif
+ std::endl;
}
private:
std::string mName;
std::chrono::time_point<std::chrono::steady_clock> mWallTime0;
+#if BOOST_VERSION > 106700
boost::timer::cpu_timer mCPUTimer;
+#endif
};
template<typename From, typename ToTypesCollectionType, size_t index = 0>