mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-31 05:55:28 +00:00
[#1174] Added duration_cast in printing
This commit is contained in:
committed by
Tomek Mrugalski
parent
11c8af9c4b
commit
e5fdb2599b
@@ -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<microseconds>(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<microseconds>(dur);
|
||||
frac -= duration_cast<microseconds>(unfrac);
|
||||
auto fsecs = frac.count();
|
||||
size_t width = MAX_FSECS_PRECISION;
|
||||
if (fsecs_precision < width) {
|
||||
|
Reference in New Issue
Block a user