From 9d755c6d683aff0f4f12406428cb8030bc766fbd Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Sat, 19 May 2018 01:24:24 -0500 Subject: [PATCH] =?UTF-8?q?Revert=20"Check=20in=20code=20to=20handle=20mis?= =?UTF-8?q?sing=20clock=5Fgettime()=20on=20most=20versions=20of=20M?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ZmqLogger.h | 6 ------ src/ZmqLogger.cpp | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/include/ZmqLogger.h b/include/ZmqLogger.h index 100718b2..c134f2cf 100644 --- a/include/ZmqLogger.h +++ b/include/ZmqLogger.h @@ -41,12 +41,6 @@ #include #include -// OS X does not have clock_gettime, use clock_get_time (https://gist.github.com/jbenet/1087739) -#ifdef __MACH__ -#include -#include -#endif - using namespace std; diff --git a/src/ZmqLogger.cpp b/src/ZmqLogger.cpp index 5a608050..27da2977 100644 --- a/src/ZmqLogger.cpp +++ b/src/ZmqLogger.cpp @@ -176,24 +176,6 @@ void ZmqLogger::AppendDebugMethod(string method_name, string arg1_name, float ar stringstream message; message << fixed << setprecision(4); - - // Prepend current time (hires) to message - struct timespec ts; -#ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time (https://gist.github.com/jbenet/1087739) - clock_serv_t cclock; - mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); - clock_get_time(cclock, &mts); - mach_port_deallocate(mach_task_self(), cclock); - ts->tv_sec = mts.tv_sec; - ts->tv_nsec = mts.tv_nsec; -#else - clock_gettime(CLOCK_REALTIME, &ts); -#endif - char timebuf[80]; - strftime(timebuf, sizeof timebuf, "%F %T", localtime(&ts.tv_sec)); - message << timebuf << "." << std::setiosflags(std::ios::right) << std::setw(9) << std::setfill('0') << ts.tv_nsec << " "; - message << method_name << " ("; // Add attributes to method JSON