aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2014-01-02 01:18:12 +0100
committerLorenz Meier <lm@inf.ethz.ch>2014-01-02 01:18:12 +0100
commiteb47a164cb44ddab70a2639ddf4f68519eadd4df (patch)
treec22e2ea5c2fa5b26687f0198e6c607d7a77ce89d /Tools
parente35598eb6b4efd459018403d18afe77c827f2121 (diff)
downloadpx4-firmware-eb47a164cb44ddab70a2639ddf4f68519eadd4df.tar.gz
px4-firmware-eb47a164cb44ddab70a2639ddf4f68519eadd4df.tar.bz2
px4-firmware-eb47a164cb44ddab70a2639ddf4f68519eadd4df.zip
Added missing HRT functionality, cleanup
Diffstat (limited to 'Tools')
-rw-r--r--Tools/tests-host/hrt.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Tools/tests-host/hrt.cpp b/Tools/tests-host/hrt.cpp
index dc9fa23de..d791e9e2a 100644
--- a/Tools/tests-host/hrt.cpp
+++ b/Tools/tests-host/hrt.cpp
@@ -3,11 +3,14 @@
#include <drivers/drv_hrt.h>
#include <stdio.h>
-uint64_t hrt_absolute_time()
-{
+hrt_abstime hrt_absolute_time() {
struct timeval te;
gettimeofday(&te, NULL); // get current time
- unsigned long long us = static_cast<uint64_t>(te.tv_sec) * 1e6 + te.tv_usec; // caculate us
- printf("us: %lld\n", us);
+ hrt_abstime us = static_cast<uint64_t>(te.tv_sec) * 1e6 + te.tv_usec; // caculate us
return us;
+}
+
+hrt_abstime hrt_elapsed_time(const volatile hrt_abstime *then) {
+ // not thread safe
+ return hrt_absolute_time() - *then;
} \ No newline at end of file