diff --git a/Log.cpp b/Log.cpp index 26317da..5a75a15 100644 --- a/Log.cpp +++ b/Log.cpp @@ -18,13 +18,18 @@ namespace coreutils { Log::Log(int level) { output = true; + + std::stringstream temp; + struct timespec timex; + clock_gettime(CLOCK_REALTIME, &timex); + temp << timex.tv_sec << "." << std::setfill('0') << std::setw(9) << timex.tv_nsec; + +// auto clock = std::chrono::system_clock::now(); +// time_t theTime = std::chrono::system_clock::to_time_t(clock); +// std::string timeOut = std::string(ctime(&theTime)); +// timeOut = timeOut.substr(0, timeOut.length() - 1); - auto clock = std::chrono::system_clock::now(); - time_t theTime = std::chrono::system_clock::to_time_t(clock); - std::string timeOut = std::string(ctime(&theTime)); - timeOut = timeOut.substr(0, timeOut.length() - 1); - - *this << timeOut; + *this << temp.str(); *this << " "; switch(level) { @@ -63,7 +68,7 @@ namespace coreutils { if(output) { std::stringstream out; - out << seq << "." << this->str() << std::endl;; + out << this->str() << std::endl;; mtx.lock(); diff --git a/includes b/includes index a7773eb..1dc98f4 100644 --- a/includes +++ b/includes @@ -33,6 +33,6 @@ #include #include #include - +#include \ No newline at end of file