diff --git a/platforms/common/include/px4_platform_common/time.h b/platforms/common/include/px4_platform_common/time.h index 793f65f2728..ba1b161c33c 100644 --- a/platforms/common/include/px4_platform_common/time.h +++ b/platforms/common/include/px4_platform_common/time.h @@ -5,10 +5,6 @@ #include #include -#if defined(__PX4_APPLE_LEGACY) -#define clockid_t int -#endif - #if defined(__PX4_POSIX) || defined(__PX4_QURT) __BEGIN_DECLS __EXPORT int px4_clock_gettime(clockid_t clk_id, struct timespec *tp); diff --git a/platforms/posix/cmake/px4_impl_os.cmake b/platforms/posix/cmake/px4_impl_os.cmake index 8137c75d190..b334336ab4c 100644 --- a/platforms/posix/cmake/px4_impl_os.cmake +++ b/platforms/posix/cmake/px4_impl_os.cmake @@ -225,21 +225,6 @@ function(px4_os_add_flags) if(UNIX AND APPLE) add_definitions(-D__PX4_DARWIN) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) - message(FATAL_ERROR "PX4 Firmware requires XCode 8 or newer on Mac OS. Version installed on this system: ${CMAKE_CXX_COMPILER_VERSION}") - endif() - - execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION) - string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) - # message(STATUS "PX4 Darwin Version: ${DARWIN_VERSION}") - if (DARWIN_VERSION LESS 16) - add_definitions( - -DCLOCK_MONOTONIC=1 - -DCLOCK_REALTIME=0 - -D__PX4_APPLE_LEGACY - ) - endif() - elseif(CYGWIN) add_definitions( -D__PX4_CYGWIN diff --git a/platforms/posix/src/px4/common/drv_hrt.cpp b/platforms/posix/src/px4/common/drv_hrt.cpp index 349986ce6d3..c4a1d9b9dc0 100644 --- a/platforms/posix/src/px4/common/drv_hrt.cpp +++ b/platforms/posix/src/px4/common/drv_hrt.cpp @@ -95,31 +95,6 @@ static void hrt_unlock() px4_sem_post(&_hrt_lock); } -#if defined(__PX4_APPLE_LEGACY) -#include - -int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) -{ - struct timeval now; - int rv = gettimeofday(&now, nullptr); - - if (rv) { - return rv; - } - - tp->tv_sec = now.tv_sec; - tp->tv_nsec = now.tv_usec * 1000; - - return 0; -} - -int px4_clock_settime(clockid_t clk_id, struct timespec *tp) -{ - /* do nothing right now */ - return 0; -} -#endif - /* * Get absolute time. */ @@ -465,23 +440,15 @@ hrt_call_invoke() int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) { - if (clk_id == CLOCK_MONOTONIC) { #if defined(ENABLE_LOCKSTEP_SCHEDULER) + + if (clk_id == CLOCK_MONOTONIC) { abstime_to_ts(tp, lockstep_scheduler.get_absolute_time()); return 0; -#else // defined(ENABLE_LOCKSTEP_SCHEDULER) -#if defined(__PX4_DARWIN) - // We don't have CLOCK_MONOTONIC on macOS, so we just have to - // resort back to CLOCK_REALTIME here. - return system_clock_gettime(CLOCK_REALTIME, tp); -#else // defined(__PX4_DARWIN) - return system_clock_gettime(clk_id, tp); -#endif // defined(__PX4_DARWIN) -#endif // defined(ENABLE_LOCKSTEP_SCHEDULER) - - } else { - return system_clock_gettime(clk_id, tp); } + +#endif // defined(ENABLE_LOCKSTEP_SCHEDULER) + return system_clock_gettime(clk_id, tp); } #if defined(ENABLE_LOCKSTEP_SCHEDULER)