40 #include <px4_platform_common/posix.h> 50 struct timeval tv1, tv2;
52 printf(
"start-time (hrt, sec/usec), end-time (hrt, sec/usec), microseconds per 1/10 second\n");
54 for (i = 0; i < 10; i++) {
56 gettimeofday(&tv1,
nullptr);
59 gettimeofday(&tv2,
nullptr);
60 printf(
"%lu (%lu/%lu), %lu (%lu/%lu), %lu\n",
61 (
unsigned long)prev, (
unsigned long)tv1.tv_sec, (
unsigned long)tv1.tv_usec,
62 (
unsigned long)now, (
unsigned long)tv2.tv_sec, (
unsigned long)tv2.tv_usec,
69 printf(
"one-second ticks\n");
71 for (i = 0; i < 3; i++) {
High-resolution timer with callouts and timekeeping.
__EXPORT void hrt_call_after(struct hrt_call *entry, hrt_abstime delay, hrt_callout callout, void *arg)
Call callout(arg) after delay has elapsed.
__EXPORT bool hrt_called(struct hrt_call *entry)
If this returns true, the entry has been invoked and removed from the callout list, or it has never been entered.
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
int test_hrt(int argc, char *argv[])
__EXPORT hrt_abstime hrt_absolute_time(void)
Get absolute time in [us] (does not wrap).