diff --git a/lib/statistics/GwStatistics.h b/lib/statistics/GwStatistics.h index b2efec8..fbf7c5e 100644 --- a/lib/statistics/GwStatistics.h +++ b/lib/statistics/GwStatistics.h @@ -1,5 +1,13 @@ #pragma once #include +#include +#include + +static inline int64_t gwMonotonicUs(){ + TickType_t ticks=xTaskGetTickCount(); + return ((int64_t)ticks) * ((int64_t)portTICK_PERIOD_MS) * 1000; +} + class TimeAverage{ double factor=0.3; double current=0; @@ -70,7 +78,7 @@ class TimeMonitor{ } void reset(){ if (last != 0 && start != 0) loop->add(last-start); - start=esp_timer_get_time(); + start=gwMonotonicUs(); for (size_t i=0;i