From 9c9ca9211fcf74398063c379c252897eadb8426c Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 5 Apr 2016 17:17:17 -0700 Subject: [PATCH] HRT fix for negative time instrumentation --- src/platforms/posix/px4_layer/drv_hrt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platforms/posix/px4_layer/drv_hrt.c b/src/platforms/posix/px4_layer/drv_hrt.c index 7c4b39af67..0e1b533d50 100644 --- a/src/platforms/posix/px4_layer/drv_hrt.c +++ b/src/platforms/posix/px4_layer/drv_hrt.c @@ -69,6 +69,7 @@ static struct work_s _hrt_work; static hrt_abstime px4_timestart = 0; static hrt_abstime _start_delay_time = 0; static hrt_abstime _delay_interval = 0; +static hrt_abstime max_time = 0; pthread_mutex_t _hrt_mutex = PTHREAD_MUTEX_INITIALIZER; static void @@ -162,7 +163,6 @@ hrt_abstime _hrt_absolute_time_internal(void) hrt_abstime hrt_absolute_time(void) { pthread_mutex_lock(&_hrt_mutex); - static hrt_abstime max_time = 0; hrt_abstime ret; @@ -189,6 +189,7 @@ hrt_abstime hrt_absolute_time(void) __EXPORT hrt_abstime hrt_reset(void) { px4_timestart = 0; + max_time = 0; return _hrt_absolute_time_internal(); }