µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
os::estd::chrono::high_resolution_clock Class Reference

#include <chrono>

Public Types

using duration = std::chrono::nanoseconds
 
using period = duration::period
 
using rep = duration::rep
 
using time_point = std::chrono::time_point< high_resolution_clock >
 

Static Public Member Functions

static time_point now () noexcept
 

Static Public Attributes

static constexpr const bool is_steady { true }
 

Detailed Description

Definition at line 197 of file chrono.

Member Typedef Documentation

◆ duration

using os::estd::chrono::high_resolution_clock::duration = std::chrono::nanoseconds

Definition at line 200 of file chrono.

◆ period

Definition at line 202 of file chrono.

◆ rep

Definition at line 201 of file chrono.

◆ time_point

Definition at line 203 of file chrono.

Member Function Documentation

◆ now()

high_resolution_clock::time_point os::estd::chrono::high_resolution_clock::now ( )
staticnoexcept

Definition at line 104 of file chrono.cpp.

105 {
106 auto cycles = rtos::hrclock.now ();
107
108#pragma GCC diagnostic push
109#if defined(__clang__)
110// error: 'long long' is incompatible with C++98
111// [-Werror,-Wc++98-compat-pedantic]
112#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
113#endif
114 // The duration is the number of sum of SysTick ticks plus the current
115 // count of CPU cycles (computed from the SysTick counter).
116 // Notice: a more exact solution would be to compute
117 // ticks * divisor + cycles, but this severely reduces the
118 // range of ticks.
119 return time_point{
120 duration{
121 duration{ cycles * 1000000000ULL
123 + realtime_clock::startup_time_point.time_since_epoch () } //
124 };
125#pragma GCC diagnostic pop
126 }
std::chrono::time_point< high_resolution_clock > time_point
Definition chrono:203
std::chrono::nanoseconds duration
Definition chrono:200
static time_point startup_time_point
Definition chrono:156
uint32_t input_clock_frequency_hz(void)
Definition os-clocks.h:919
virtual timestamp_t now(void) override
Tell the current time.
clock_highres hrclock
The high resolution clock object instance.

References os::rtos::hrclock, os::rtos::clock_highres::input_clock_frequency_hz(), os::rtos::clock_highres::now(), and os::estd::chrono::realtime_clock::startup_time_point.

Member Data Documentation

◆ is_steady

constexpr const bool os::estd::chrono::high_resolution_clock::is_steady { true }
staticconstexpr

Definition at line 206 of file chrono.


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