zpp
Zephyr C++20 Framework
zpp::uptime_clock Class Reference

Clock measuring elapsed time since the system booted. More...

#include <clock.hpp>

Public Types

using rep = int64_t
 
using period = std::nano
 
using duration = std::chrono::duration< rep, period >
 
using time_point = std::chrono::time_point< uptime_clock >
 

Static Public Member Functions

static time_point now () noexcept
 Get current uptime. More...
 

Static Public Attributes

static constexpr bool is_steady = false
 

Detailed Description

Clock measuring elapsed time since the system booted.

Definition at line 22 of file clock.hpp.

Member Typedef Documentation

◆ duration

using zpp::uptime_clock::duration = std::chrono::duration<rep, period>

Definition at line 26 of file clock.hpp.

◆ period

using zpp::uptime_clock::period = std::nano

Definition at line 25 of file clock.hpp.

◆ rep

using zpp::uptime_clock::rep = int64_t

Definition at line 24 of file clock.hpp.

◆ time_point

using zpp::uptime_clock::time_point = std::chrono::time_point<uptime_clock>

Definition at line 27 of file clock.hpp.

Member Function Documentation

◆ now()

static time_point zpp::uptime_clock::now ( )
inlinestaticnoexcept

Get current uptime.

Returns
current uptime as time_point.

Definition at line 35 of file clock.hpp.

36  {
37  return time_point(duration(k_ticks_to_ns_floor64(k_uptime_ticks())));
38  }
std::chrono::duration< rep, period > duration
Definition: clock.hpp:26
std::chrono::time_point< uptime_clock > time_point
Definition: clock.hpp:27

Referenced by ZTEST().

Member Data Documentation

◆ is_steady

constexpr bool zpp::uptime_clock::is_steady = false
staticconstexpr

Definition at line 28 of file clock.hpp.


The documentation for this class was generated from the following file: