From 415612f8af4b63b3b6cde677bb792a1e5bfdc61c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Dauphin?= Date: Tue, 18 Apr 2017 08:54:54 +0200 Subject: [PATCH] time OS-specific implementation chosen by CMakeLists.txt (#124) --- rcl/CMakeLists.txt | 7 +++++++ rcl/src/rcl/time.c | 10 ++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rcl/CMakeLists.txt b/rcl/CMakeLists.txt index 4d9ecb2..f70654b 100644 --- a/rcl/CMakeLists.txt +++ b/rcl/CMakeLists.txt @@ -16,6 +16,12 @@ if(NOT WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -Wextra") endif() +if(WIN32) + set(time_impl_c src/rcl/time_win32.c) +else() + set(time_impl_c src/rcl/time_unix.c) +endif() + set(${PROJECT_NAME}_sources src/rcl/allocator.c src/rcl/client.c @@ -29,6 +35,7 @@ set(${PROJECT_NAME}_sources src/rcl/service.c src/rcl/subscription.c src/rcl/time.c + ${time_impl_c} src/rcl/timer.c src/rcl/wait.c ) diff --git a/rcl/src/rcl/time.c b/rcl/src/rcl/time.c index d52b099..0bba26d 100644 --- a/rcl/src/rcl/time.c +++ b/rcl/src/rcl/time.c @@ -12,16 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include "rcl/time.h" + #include #include -#if defined(WIN32) -#include "./time_win32.c" -#else // defined(WIN32) -#include "./time_unix.c" -#endif // defined(WIN32) - +#include "./common.h" #include "./stdatomic_helper.h" +#include "rcl/error_handling.h" // Process default ROS time sources static rcl_time_source_t * rcl_default_ros_time_source;