From: Francis Dupont Date: Wed, 1 Apr 2020 09:21:03 +0000 (+0200) Subject: [#1174] Added duration_cast in printing X-Git-Tag: Kea-1.7.10~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e5fdb2599bc0ee9bc7c1d63f05c8fe9502209a48;p=thirdparty%2Fkea.git [#1174] Added duration_cast in printing --- diff --git a/src/lib/util/chrono_time_utils.cc b/src/lib/util/chrono_time_utils.cc index f351397551..4905c8b2e8 100644 --- a/src/lib/util/chrono_time_utils.cc +++ b/src/lib/util/chrono_time_utils.cc @@ -28,7 +28,8 @@ isc::util::clockToText(system_clock::time_point t, size_t fsecs_precision) { // If the requested precision is less than the maximum native precision // we will divide the fractional seconds value by 10^(max - requested) if (fsecs_precision) { - microseconds frac = t - system_clock::from_time_t(tt); + system_clock::duration dur = t - system_clock::from_time_t(tt); + microseconds frac = duration_cast(dur); auto fsecs = frac.count(); size_t width = MAX_FSECS_PRECISION; if (fsecs_precision < width) { @@ -63,7 +64,8 @@ isc::util::durationToText(system_clock::duration dur, size_t fsecs_precision) { // If the requested precision is less than the maximum native precision // we will divide the fractional seconds value by 10^(max - requested) if (fsecs_precision) { - microseconds frac = dur - unfrac; + microseconds frac = duration_cast(dur); + frac -= duration_cast(unfrac); auto fsecs = frac.count(); size_t width = MAX_FSECS_PRECISION; if (fsecs_precision < width) {