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 #if (INT_MAX >= INT32_MAX)
37 #define ETL_CHRONO_SYSTEM_CLOCK_DURATION etl::chrono::nanoseconds
39 #define ETL_CHRONO_SYSTEM_CLOCK_DURATION etl::chrono::milliseconds
43#if !defined(ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY)
44 #define ETL_CHRONO_SYSTEM_CLOCK_IS_STEADY true
47#if !defined(ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION)
48 #if (INT_MAX >= INT32_MAX)
49 #define ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION etl::chrono::nanoseconds
51 #define ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION etl::chrono::milliseconds
55#if !defined(ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY)
56 #define ETL_CHRONO_HIGH_RESOLUTION_CLOCK_IS_STEADY true
59#if !defined(ETL_CHRONO_STEADY_CLOCK_DURATION)
60 #if (INT_MAX >= INT32_MAX)
61 #define ETL_CHRONO_STEADY_CLOCK_DURATION etl::chrono::nanoseconds
63 #define ETL_CHRONO_STEADY_CLOCK_DURATION etl::chrono::milliseconds
67extern "C" ETL_CHRONO_SYSTEM_CLOCK_DURATION::rep etl_get_system_clock();
68extern "C" ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION::rep etl_get_high_resolution_clock();
69extern "C" ETL_CHRONO_STEADY_CLOCK_DURATION::rep etl_get_steady_clock();
75 namespace private_chrono
80 static ETL_CONSTANT
bool is_steady = b;
84 ETL_CONSTANT
bool is_steady_trait<b>::is_steady;
94 using duration = ETL_CHRONO_SYSTEM_CLOCK_DURATION;
95 using rep = duration::rep;
96 using period = duration::period;
100 static time_point now() ETL_NOEXCEPT
102 return time_point(duration(etl_get_system_clock()));
106 static etl::time_t to_time_t(
const time_point& t) ETL_NOEXCEPT
112 return dur.count() / duration::period::den;
116 static time_point from_time_t(etl::time_t t) ETL_NOEXCEPT
119 duration dur(t * duration::period::den);
122 return time_point(dur);
133 using duration = ETL_CHRONO_HIGH_RESOLUTION_CLOCK_DURATION;
134 using rep = duration::rep;
135 using period = duration::period;
139 static time_point now() ETL_NOEXCEPT
141 return time_point(duration(etl_get_high_resolution_clock()));
152 using duration = ETL_CHRONO_STEADY_CLOCK_DURATION;
153 using rep = duration::rep;
154 using period = duration::period;
158 static time_point now() ETL_NOEXCEPT
160 return time_point(duration(etl_get_steady_clock()));
167 template <
typename Duration>
180 template <
typename TDuration>
183 using local_seconds = local_time<etl::chrono::seconds>;
184 using local_days = local_time<etl::chrono::days>;
190 template <
typename TToClock,
typename TFromClock,
typename TFromDuration>
195 auto from_duration = from_time_point.time_since_epoch();
The high resolution clock time.
Definition clocks.h:130
The steady clock time.
Definition clocks.h:149
The system clock time.
Definition clocks.h:91
Definition time_point.h:45
ETL_NODISCARD ETL_CONSTEXPR14 duration time_since_epoch() const ETL_NOEXCEPT
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:192
etl::chrono::time_point< etl::chrono::system_clock, Duration > sys_time
System time.
Definition clocks.h:168
ETL_CONSTEXPR14 TToDuration duration_cast(const etl::chrono::duration< TRep, TPeriod > &d) ETL_NOEXCEPT
duration_cast
Definition duration.h:343
bitset_ext
Definition absolute.h:40
Local time.
Definition clocks.h:177