tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches

C++ time utilities. More...

Classes

struct  day
 The class day represents a day in a month. More...
 
struct  duration< Rep, Period >
 Class template etl::chrono::duration represents a time interval. More...
 
struct  duration_values< Rep >
 The etl::chrono::duration_values type defines three common durations. More...
 
struct  is_clock< typename >
 If T satisfies the Clock requirements, provides the member constant value equal true. For any other type, value is false. More...
 
struct  last_spec
 last_spec is an empty tag type that is used in conjunction with other calendar types to indicate the last thing in a sequence. More...
 
struct  local_t
 The class local_t is a pseudo-clock that is used as the first template argument to etl::chrono::time_point to indicate that the time point represents local time with respect of a not-yet-specified time zone. local_time supports streaming and the full set of time point arithmetic. More...
 
struct  month
 The class month represents a month in a year. More...
 
struct  month_day
 
struct  month_day_last
 
struct  month_weekday
 
struct  month_weekday_last
 
struct  system_clock
 
struct  time_point< Clock, Duration >
 Class template time_point represents a point in time. It is implemented as if it stores a value of type Duration indicating the time interval from the start of the Clock's epoch. More...
 
struct  treat_as_floating_point< Rep >
 The etl::chrono::treat_as_floating_point trait helps determine if a duration can be converted to another duration with a different tick period. More...
 
struct  weekday
 
struct  weekday_indexed
 
struct  weekday_last
 
struct  year_month
 
struct  year_month_day
 
struct  year_month_day_last
 
struct  year_month_weekday
 
struct  year_month_weekday_last
 

Typedefs

using local_days = local_time<etl::chrono::days>
 
using local_seconds = local_time<etl::chrono::seconds>
 
template<typename Duration>
using local_time = etl::chrono::time_point<etl::chrono::local_t, Duration>
 

Functions

template<typename R, typename P>
requires (numeric_limits<R>::is_signed)
constexpr auto abs (duration< R, P > d) noexcept(is_arithmetic_v< R >) -> duration< R, P >
 Returns the absolute value of the duration d. Specifically, if d >= d.zero(), return d, otherwise return -d. The function does not participate in the overload resolution unless etl::numeric_limits<R>::is_signed is true.
 
template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
constexpr auto ceil (duration< Rep, Period > const &d) noexcept(is_arithmetic_v< Rep > and is_arithmetic_v< typename To::rep >) -> To
 
template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
constexpr auto ceil (time_point< Clock, Duration > const &tp) -> time_point< Clock, To >
 
template<typename ToDur, typename Rep, typename Period>
constexpr auto duration_cast (duration< Rep, Period > const &duration) noexcept(is_arithmetic_v< Rep > and is_arithmetic_v< typename ToDur::rep >) -> ToDur
 Converts a duration to a duration of different type ToDur.
 
template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
constexpr auto floor (duration< Rep, Period > const &d) noexcept(is_arithmetic_v< Rep > and is_arithmetic_v< typename To::rep >) -> To
 Returns the greatest duration t representable in ToDuration that is less or equal to d. The function does not participate in the overload resolution unless ToDuration is an instance of etl::chrono::duration.
 
template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
constexpr auto floor (time_point< Clock, Duration > const &tp) -> time_point< Clock, To >
 
template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
constexpr auto round (duration< Rep, Period > const &dur) noexcept(is_arithmetic_v< Rep > and is_arithmetic_v< typename To::rep >) -> To
 
template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
constexpr auto round (time_point< Clock, Duration > const &tp) -> time_point< Clock, To >
 
template<typename ToDuration, typename Clock, typename Duration>
requires (detail::is_duration_v<ToDuration>)
constexpr auto time_point_cast (time_point< Clock, Duration > const &tp) -> ToDuration
 

Variables

template<typename T>
constexpr bool is_clock_v = is_clock<T>::value
 
constexpr auto last = last_spec{}
 
template<typename Rep>
constexpr bool treat_as_floating_point_v = treat_as_floating_point<Rep>::value
 

Detailed Description

C++ time utilities.

Typedef Documentation

◆ local_days

◆ local_seconds

◆ local_time

template<typename Duration>
using local_time = etl::chrono::time_point<etl::chrono::local_t, Duration>

Function Documentation

◆ abs()

template<typename R, typename P>
requires (numeric_limits<R>::is_signed)
auto abs ( duration< R, P > d) -> duration<R, P>
constexprnoexcept

Returns the absolute value of the duration d. Specifically, if d >= d.zero(), return d, otherwise return -d. The function does not participate in the overload resolution unless etl::numeric_limits<R>::is_signed is true.

◆ ceil() [1/2]

template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
auto ceil ( duration< Rep, Period > const & d) -> To
nodiscardconstexprnoexcept

◆ ceil() [2/2]

template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
auto ceil ( time_point< Clock, Duration > const & tp) -> time_point<Clock, To>
nodiscardconstexpr

◆ duration_cast()

template<typename ToDur, typename Rep, typename Period>
auto duration_cast ( duration< Rep, Period > const & duration) -> ToDur
related

Converts a duration to a duration of different type ToDur.

◆ floor() [1/2]

template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
auto floor ( duration< Rep, Period > const & d) -> To
nodiscardconstexprnoexcept

Returns the greatest duration t representable in ToDuration that is less or equal to d. The function does not participate in the overload resolution unless ToDuration is an instance of etl::chrono::duration.

◆ floor() [2/2]

template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
auto floor ( time_point< Clock, Duration > const & tp) -> time_point<Clock, To>
nodiscardconstexpr

◆ round() [1/2]

template<typename To, typename Rep, typename Period>
requires (detail::is_duration_v<To>)
auto round ( duration< Rep, Period > const & dur) -> To
nodiscardconstexprnoexcept

◆ round() [2/2]

template<typename To, typename Clock, typename Duration>
requires (detail::is_duration_v<To>)
auto round ( time_point< Clock, Duration > const & tp) -> time_point<Clock, To>
nodiscardconstexpr

◆ time_point_cast()

template<typename ToDuration, typename Clock, typename Duration>
requires (detail::is_duration_v<ToDuration>)
auto time_point_cast ( time_point< Clock, Duration > const & tp) -> ToDuration
nodiscardconstexpr

Variable Documentation

◆ is_clock_v

template<typename T>
bool is_clock_v = is_clock<T>::value
inlineconstexpr

◆ last

auto last = last_spec{}
related

◆ treat_as_floating_point_v

template<typename Rep>
bool treat_as_floating_point_v = treat_as_floating_point<Rep>::value
inlineconstexpr