From: Francis Dupont Date: Wed, 15 Jul 2020 19:46:39 +0000 (+0200) Subject: [#1174] Fixed the same duration type bug X-Git-Tag: Kea-1.7.10~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c6f9579852f94e73bb213c3a2ad772b8d4863e74;p=thirdparty%2Fkea.git [#1174] Fixed the same duration type bug --- diff --git a/configure.ac b/configure.ac index c4ed915a8d..d162879d62 100755 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,21 @@ AC_COMPILE_IFELSE( [Define to 1 if std::is_base_of is available])], [AC_MSG_RESULT(no)]) +# Check if system and steady clocks use the same duration type. +AC_MSG_CHECKING([for different std::chrono::duration types]) +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + #include ] + [static_assert(!std::is_same< + std::chrono::system_clock::duration, + std::chrono::steady_clock::duration + >::value, "");])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE([CHRONO_SAME_DURATION], [1], + [Define to 1 if system and steady clocks use the same duration type])]) + dnl Determine if we are using GNU sed GNU_SED=no $SED --version 2> /dev/null | grep GNU > /dev/null 2>&1 diff --git a/src/lib/util/chrono_time_utils.cc b/src/lib/util/chrono_time_utils.cc index 1bc3a13a7c..6c76112fd4 100644 --- a/src/lib/util/chrono_time_utils.cc +++ b/src/lib/util/chrono_time_utils.cc @@ -92,9 +92,11 @@ template std::string durationToText(system_clock::duration dur, size_t fsecs_precision); +#if !CHRONO_SAME_DURATION template std::string durationToText(steady_clock::duration dur, size_t fsecs_precision); +#endif } // end of isc::util namespace } // end of isc namespace