diff --git a/src/espchrono.h b/src/espchrono.h index 253782b..85eeb20 100644 --- a/src/espchrono.h +++ b/src/espchrono.h @@ -135,6 +135,18 @@ struct millis_clock static time_point now() noexcept; }; +struct micros_clock +{ + typedef std::chrono::microseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef std::chrono::time_point time_point; + + static constexpr bool is_steady = true; + + static time_point now() noexcept; +}; + struct DateTime { date::year_month_day date; diff --git a/src/espchrono_impl.cpp b/src/espchrono_impl.cpp index 2ce9875..77cd57b 100644 --- a/src/espchrono_impl.cpp +++ b/src/espchrono_impl.cpp @@ -24,3 +24,8 @@ auto espchrono::millis_clock::now() noexcept -> time_point { return time_point{std::chrono::floor(std::chrono::microseconds{esp_timer_get_time()})}; } + +auto espchrono::micros_clock::now() noexcept -> time_point +{ + return time_point{std::chrono::microseconds{esp_timer_get_time()}}; +}