diff --git a/deps/rmonotonic/CMakeLists.txt b/deps/rmonotonic/CMakeLists.txt index 119b3c31143c086628e05a5c5eb46793d291fc67..b870b7d6d7a3817c38bfd4c488f75890fd115b7f 100644 --- a/deps/rmonotonic/CMakeLists.txt +++ b/deps/rmonotonic/CMakeLists.txt @@ -2,6 +2,10 @@ AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST) add_definitions(-DUSE_PROCESSOR_CLOCK) +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../MsvcLibX/include) + ADD_LIBRARY(rmonotonic ${SOURCE_LIST}) TARGET_INCLUDE_DIRECTORIES(rmonotonic PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc) -TARGET_LINK_LIBRARIES(rmonotonic MsvcLibXw) +IF (TD_WINDOWS) + TARGET_LINK_LIBRARIES(rmonotonic MsvcLibXw) +ENDIF () diff --git a/deps/rmonotonic/src/monotonic.c b/deps/rmonotonic/src/monotonic.c index 37023ce2733f7b28b5029df5d4f5317539d66ee7..622ac1b075a66ec49338cda3cc4afbc8355636dd 100644 --- a/deps/rmonotonic/src/monotonic.c +++ b/deps/rmonotonic/src/monotonic.c @@ -7,8 +7,10 @@ #undef NDEBUG #include +#if defined(_WIN32) || defined(_WIN64) #include "msvcTime.h" #include "msvcStdio.h" +#endif /* The function pointer for clock retrieval. */ monotime (*getMonotonicUs)(void) = NULL; diff --git a/src/util/src/ttimer.c b/src/util/src/ttimer.c index 1fe2d2f8723828a9b2a1ff0ba9b061b5d5965114..6029edf5120314cf13405f69fb8e120e73d61183 100644 --- a/src/util/src/ttimer.c +++ b/src/util/src/ttimer.c @@ -506,7 +506,6 @@ static void taosTmrModuleInit(void) { pthread_mutex_init(&tmrCtrlMutex, NULL); - tmrInfo("ttimer monotonic clock source:%s", monotonicInit()); int64_t now = getMonotonicMs(); for (int i = 0; i < tListLen(wheels); i++) { time_wheel_t* wheel = wheels + i; @@ -538,6 +537,8 @@ static void taosTmrModuleInit(void) { } void* taosTmrInit(int maxNumOfTmrs, int resolution, int longest, const char* label) { + tmrInfo("ttimer monotonic clock source:%s", monotonicInit()); + pthread_once(&tmrModuleInit, taosTmrModuleInit); pthread_mutex_lock(&tmrCtrlMutex);