13using namespace std::chrono;
 
   19clockToText(std::chrono::system_clock::time_point t, 
size_t fsecs_precision) {
 
   20    time_t tt = system_clock::to_time_t(t);
 
   22    localtime_r(&tt, &tm);
 
   24    s << (tm.tm_year + 1900)
 
   25      << 
"-" << std::setw(2) << std::setfill(
'0') << (tm.tm_mon + 1)
 
   26      << 
"-" << std::setw(2) << std::setfill(
'0') << tm.tm_mday
 
   27      << 
" " << std::setw(2) << std::setfill(
'0') << tm.tm_hour
 
   28      << 
":" << std::setw(2) << std::setfill(
'0') << tm.tm_min
 
   29      << 
":" << std::setw(2) << std::setfill(
'0') << tm.tm_sec;
 
   33    if (fsecs_precision) {
 
   34        system_clock::duration dur = t - system_clock::from_time_t(tt);
 
   35        microseconds frac = duration_cast<microseconds>(dur);
 
   36        auto fsecs = frac.count();
 
   38        if (fsecs_precision < width) {
 
   39            for (
size_t i = 0; i < width - fsecs_precision; ++i) {
 
   43            width = fsecs_precision;
 
   46        s << 
"." << std::setw(width)
 
 
   54template<
typename Duration> std::string
 
   56    seconds unfrac = duration_cast<seconds>(dur);
 
   57    auto secs = unfrac.count();
 
   59    auto hours = secs / 3600;
 
   61    s << std::setw(2) << std::setfill(
'0') << hours;
 
   62    auto mins = secs / 60;
 
   64    s << 
":" << std::setw(2) << std::setfill(
'0') << mins
 
   65      << 
":" << std::setw(2) << std::setfill(
'0') << secs;
 
   69    if (fsecs_precision) {
 
   70        microseconds frac = duration_cast<microseconds>(dur);
 
   71        frac -= duration_cast<microseconds>(unfrac);
 
   72        auto fsecs = frac.count();
 
   74        if (fsecs_precision < width) {
 
   75            for (
size_t i = 0; i < width - fsecs_precision; ++i) {
 
   79            width = fsecs_precision;
 
   82        s << 
"." << std::setw(width)
 
 
   93                                       size_t fsecs_precision);
 
   95#ifndef CHRONO_SAME_DURATION 
   98                                       size_t fsecs_precision);
 
template std::string durationToText< steady_clock::duration >(steady_clock::duration dur, size_t fsecs_precision)
const size_t MAX_FSECS_PRECISION
The number of digits of fractional seconds supplied by the underlying class, boost::posix_time.
std::string durationToText(boost::posix_time::time_duration dur, size_t fsecs_precision=MAX_FSECS_PRECISION)
Converts StatsDuration to text.
std::string clockToText(std::chrono::system_clock::time_point t, size_t fsecs_precision)
Converts chrono time point structure to text.
template std::string durationToText< system_clock::duration >(system_clock::duration dur, size_t fsecs_precision)
Defines the logger used by the top-level component of kea-lfc.