diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 70a9c5f02d..7cedbd0e7c 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -93,37 +93,7 @@ static void hrt_unlock(void) px4_sem_post(&_hrt_lock); } -#if (defined(__APPLE__) && defined(__MACH__)) -#include -#include -#define CLOCK_REALTIME 0 - -#ifndef CLOCK_MONOTONIC -#define CLOCK_MONOTONIC 1 -#endif - -int px4_clock_gettime(clockid_t clk_id, struct timespec *tp) -{ - struct timeval now; - int rv = gettimeofday(&now, NULL); - - 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; -} - -#elif defined(__QURT) +#if defined(__QURT) #include "dspal_time.h" diff --git a/src/platforms/px4_time.h b/src/platforms/px4_time.h index d57f8e9103..a3bcc90605 100644 --- a/src/platforms/px4_time.h +++ b/src/platforms/px4_time.h @@ -3,39 +3,17 @@ #include #include -#if defined(__PX4_LINUX) || defined(__PX4_NUTTX) +#if defined(__PX4_LINUX) || defined(__PX4_NUTTX) || defined(__PX4_DARWIN) #define px4_clock_gettime clock_gettime #define px4_clock_settime clock_settime -#elif defined(__PX4_DARWIN) - -__BEGIN_DECLS - -#define clockid_t unsigned -#define CLOCK_REALTIME 0 - -int px4_clock_gettime(clockid_t clk_id, struct timespec *tp); -int px4_clock_settime(clockid_t clk_id, struct timespec *tp); - -__EXPORT unsigned int sleep(unsigned int sec); - -__END_DECLS - #elif defined(__PX4_QURT) #include __BEGIN_DECLS -#if 0 -#if !defined(__cplusplus) -struct timespec { - time_t tv_sec; - long tv_nsec; -}; -#endif -#endif int px4_clock_gettime(clockid_t clk_id, struct timespec *tp); int px4_clock_settime(clockid_t clk_id, struct timespec *tp);