31#ifndef ETL_IN_CHRONO_H
32 #error DO NOT DIRECTLY INCLUDE THIS FILE. USE CHRONO.H
35#if !defined(ETL_CHRONO_SYSTEM_CLOCK_DURATION)
36 #define ETL_CHRONO_SYSTEM_CLOCK_DURATION etl::chrono::nanoseconds
39#if !defined(ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY)
40 #define ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY true
43#if !defined(ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION)
44 #define ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION etl::chrono::nanoseconds
47#if !defined(ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY)
48 #define ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY true
51#if !defined(ETL_CHRONO_STEADY_CLOCK_DURATION)
52#define ETL_CHRONO_STEADY_CLOCK_DURATION etl::chrono::nanoseconds
55extern "C" ETL_CHRONO_SYSTEM_CLOCK_DURATION::rep etl_get_system_clock();
56extern "C" ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION::rep etl_get_high_resolution_clock();
57extern "C" ETL_CHRONO_STEADY_CLOCK_DURATION::rep etl_get_steady_clock();
63 namespace private_chrono
68 static ETL_CONSTANT
bool is_steady = b;
72 ETL_CONSTANT
bool is_steady_trait<b>::is_steady;
82 using duration = ETL_CHRONO_SYSTEM_CLOCK_DURATION;
83 using rep = duration::rep;
84 using period = duration::period;
88 static time_point now() ETL_NOEXCEPT
90 return time_point(duration(etl_get_system_clock()));
94 static etl::time_t to_time_t(
const time_point& t) ETL_NOEXCEPT
100 return dur.count() / duration::period::den;
104 static time_point from_time_t(etl::time_t t) ETL_NOEXCEPT
107 duration dur(t * duration::period::den);
110 return time_point(dur);
121 using duration = ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION;
122 using rep = duration::rep;
123 using period = duration::period;
127 static time_point now() ETL_NOEXCEPT
129 return time_point(duration(etl_get_high_resolution_clock()));
140 using duration = ETL_CHRONO_STEADY_CLOCK_DURATION;
141 using rep = duration::rep;
142 using period = duration::period;
146 static time_point now() ETL_NOEXCEPT
148 return time_point(duration(etl_get_steady_clock()));
155 template <
typename Duration>
168 template <
typename TDuration>
171 using local_seconds = local_time<etl::chrono::seconds>;
172 using local_days = local_time<etl::chrono::days>;
178 template <
typename TToClock,
typename TFromClock,
typename TFromDuration>
183 auto from_duration = from_time_point.time_since_epoch();
The high resolution clock time.
Definition clocks.h:118
The steady clock time.
Definition clocks.h:137
The system clock time.
Definition clocks.h:79
Definition time_point.h:45
ETL_NODISCARD ETL_CONSTEXPR14 duration time_since_epoch() const ETL_NOEXCEPT
Returns a duration representing the amount of time between this and the clock's epoch.
Definition time_point.h:100
ETL_CONSTEXPR14 etl::chrono::time_point< TToClock, typename TToClock::duration > clock_cast(const etl::chrono::time_point< TFromClock, TFromDuration > &from_time_point) ETL_NOEXCEPT
Definition clocks.h:180
etl::chrono::time_point< etl::chrono::system_clock, Duration > sys_time
System time.
Definition clocks.h:156
ETL_CONSTEXPR14 TToDuration duration_cast(const etl::chrono::duration< TRep, TPeriod > &d) ETL_NOEXCEPT
duration_cast
Definition duration.h:339
bitset_ext
Definition absolute.h:39
Local time.
Definition clocks.h:165