From 16fbb700ed82cf6d3aad3a9c293b0e8068840b96 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 27 Dec 2021 12:08:57 +0100 Subject: Fix build on Debian and Ubuntu versions --- src/test-unicode.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/test-unicode.cpp') 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 #include #include +#include +#if BOOST_VERSION > 106700 +// CPU Timer in Debian 10 boost is broken, so leave it to std::chrono wall clock #include +#endif #include #include @@ -99,6 +103,10 @@ namespace std { return os; } +} // namespace std + +namespace { + // utility wrapper to adapt locale-bound facets for wstring/wbuffer convert template 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(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 mWallTime0; +#if BOOST_VERSION > 106700 boost::timer::cpu_timer mCPUTimer; +#endif }; template -- cgit v1.2.3