31 #ifndef WIN32_LEAN_AND_MEAN 32 #define WIN32_LEAN_AND_MEAN 45 #include <mach/clock.h> 46 #include <mach/mach.h> 50 #include <boost/lexical_cast.hpp> 61 return ::GetTickCount64() * 1000000;
63 static LARGE_INTEGER pcfreq = {0};
66 QueryPerformanceFrequency(&pcfreq);
67 QueryPerformanceCounter(&ticks);
68 ticks.QuadPart *= 1000000000;
69 return ticks.QuadPart / pcfreq.QuadPart;
70 #elif defined(__MACH__) 74 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
75 clock_get_time(cclock, &mts);
76 mach_port_deallocate(mach_task_self(), cclock);
78 return ((
uint64_t)mts.tv_sec * 1000000000) + (mts.tv_nsec);
81 if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) {
84 return ((
uint64_t)ts.tv_sec * 1000000000) + (ts.tv_nsec);
96 std::cout <<
"# " << cmd << std::endl;
100 char path[1000] = {0};
101 #if !defined(__GNUC__) 102 fp = _popen(cmd.c_str(),
"r");
104 fp = popen(cmd.c_str(),
"r");
106 while ( fgets( path, 1000, fp ) != NULL )
109 #if !defined(__GNUC__) 122 return boost::lexical_cast<
std::string>(GetCurrentThreadId());
123 #elif defined(__GNUC__) 124 return boost::lexical_cast<
std::string>(pthread_self());
131 return gmtime_s(&tm, &t);
133 return gmtime_r(&t, &tm);
uint64_t get_tick_count()
bool get_gmt_time(time_t t, struct tm &tm)
unsigned __int64 uint64_t
int call_sys_cmd(const std::string &cmd)
std::string get_thread_string_id()