diff --git a/src/log4cpp.cpp b/src/log4cpp.cpp index 9581282..403fe86 100644 --- a/src/log4cpp.cpp +++ b/src/log4cpp.cpp @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -35,13 +34,12 @@ void print_timestamp() // retrieve accurate time for milliseconds display struct timeval secs; (void)::gettimeofday(&secs, nullptr); - int ms = static_cast(std::roundf(secs.tv_usec / 1000.0)) % 1000; // create a date/time stamp char dtstamp[20]; std::strftime(dtstamp, 20, "%F %T", std::localtime(&secs.tv_sec)); - std::cerr << dtstamp << "." << std::setw(3) << ms << " "; + std::cerr << dtstamp << "." << std::setw(6) << secs.tv_usec << " "; #if __APPLE__ std::cerr << getprogname() << "[" << getpid() << "] "; #elif __linux__