7 #ifndef ZPP_INCLUDE_ZPP_CLOCK_HPP
8 #define ZPP_INCLUDE_ZPP_CLOCK_HPP
10 #include <zephyr/kernel.h>
11 #include <zephyr/sys_clock.h>
12 #include <zephyr/sys/__assert.h>
26 using duration = std::chrono::duration<rep, period>;
27 using time_point = std::chrono::time_point<uptime_clock>;
49 using duration = std::chrono::duration<rep, period>;
71 template<
class T_Rep,
class T_Period>
72 constexpr k_ticks_t
to_tick(
const std::chrono::duration<T_Rep, T_Period>& d) noexcept
74 using namespace std::chrono;
76 return k_ns_to_ticks_floor64(duration_cast<nanoseconds>(d).count());
87 template<
class T_Rep,
class T_Period>
88 constexpr k_timeout_t
to_timeout(
const std::chrono::duration<T_Rep, T_Period>& d) noexcept
Clock representing the system’s hardware clock.
static time_point now() noexcept
Get current cycle count.
std::chrono::duration< rep, period > duration
static constexpr bool is_steady
std::chrono::time_point< cycle_clock > time_point
Clock measuring elapsed time since the system booted.
static constexpr bool is_steady
std::chrono::duration< rep, period > duration
std::chrono::time_point< uptime_clock > time_point
static time_point now() noexcept
Get current uptime.
constexpr k_timeout_t to_timeout(const std::chrono::duration< T_Rep, T_Period > &d) noexcept
convert a duration to tick
constexpr k_ticks_t to_tick(const std::chrono::duration< T_Rep, T_Period > &d) noexcept
convert a duration to tick