Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::chrono Namespace Reference

Typedef Documentation

◆ hours

Hours convenience type alias.

◆ microseconds

Microseconds convenience type alias.

◆ milliseconds

Milliseconds convenience type alias.

◆ minutes

Seconds convenience type alias.

◆ nanoseconds

Nanoseconds convenience type alias.

◆ seconds

Seconds convenience type alias.

Function Documentation

◆ duration_cast()

template<typename ToDuration, typename Rep, typename Period, arene::base::constraints< enable_if_t<::arene::base::is_instantiation_of_v< ToDuration, duration > > > = nullptr, typename ConversionFactor = ratio_divide<Period, typename ToDuration::period>, typename CommonRep = std::common_type_t<typename ToDuration::rep, Rep, intmax_t>>
auto std::chrono::duration_cast ( duration< Rep, Period > const & duration) -> ToDuration
constexprnoexcept

Convert a duration to a different duration type.

Template Parameters
ToDurationThe target duration type to convert to
RepThe representation type of the source duration
PeriodThe period type of the source duration
Parameters
durationThe source duration to convert
Returns
A duration of type ToDuration converted from the source duration
Note
This function only participates in overload resolution if ToDuration is an instantiation of duration

◆ operator!=() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator!= ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Inequality comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if the durations represent different time intervals, false otherwise

◆ operator!=() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator!= ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for inequality if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left and right refer to different time points, otherwise false

◆ operator%() [1/2]

template<typename Rep1, typename Period, typename Rep2, arene::base::constraints< enable_if_t< is_convertible_v< Rep2, std::common_type_t< Rep1, Rep2 > > >, enable_if_t<!::arene::base::is_instantiation_of_v< Rep2, duration > > > = nullptr>
auto std::chrono::operator% ( duration< Rep1, Period > const & dur,
Rep2 const & scalar ) -> duration<std::common_type_t<Rep1, Rep2>, Period>
constexprnoexcept

Modulo operator for duration and scalar.

Template Parameters
Rep1Representation type of the duration
PeriodPeriod type of the duration
Rep2Type of the scalar
Parameters
durThe duration
scalarThe scalar
Returns
A duration representing the duration modulo the scalar

◆ operator%() [2/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator% ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> std::common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
constexprnoexcept

Modulo operator for two durations.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
A duration representing the first duration modulo the second

◆ operator*() [1/2]

template<typename Rep1, typename Period, typename Rep2, arene::base::constraints< enable_if_t< is_convertible_v< Rep2, std::common_type_t< Rep1, Rep2 > > > > = nullptr>
auto std::chrono::operator* ( duration< Rep1, Period > const & dur,
Rep2 const & scalar ) -> duration<std::common_type_t<Rep1, Rep2>, Period>
constexprnoexcept

Multiplication operator for duration and scalar.

Template Parameters
Rep1Representation type of the duration
PeriodPeriod type of the duration
Rep2Type of the scalar
Parameters
durThe duration
scalarThe scalar
Returns
A duration representing the duration multiplied by the scalar

◆ operator*() [2/2]

template<typename Rep1, typename Rep2, typename Period, arene::base::constraints< enable_if_t< is_convertible_v< Rep1, std::common_type_t< Rep1, Rep2 > > > > = nullptr>
auto std::chrono::operator* ( Rep1 const & scalar,
duration< Rep2, Period > const & dur ) -> duration<std::common_type_t<Rep1, Rep2>, Period>
constexprnoexcept

Multiplication operator for scalar and duration.

Template Parameters
Rep1Type of the scalar
Rep2Representation type of the duration
PeriodPeriod type of the duration
Parameters
scalarThe scalar
durThe duration
Returns
A duration representing the scalar multiplied by the duration

◆ operator+() [1/3]

template<class Rep1, class Period1, class Clock, class Duration2>
auto std::chrono::operator+ ( duration< Rep1, Period1 > const & left,
time_point< Clock, Duration2 > const & right ) -> time_point<Clock, common_type_t<duration<Rep1, Period1>, Duration2>>
constexprnoexcept

Add a time_point to a duration when the two are compatible.

Template Parameters
Rep1The arithmetic representation of the duration, deduced from left
Period1The tick period of the duration, deduced from left
ClockThe clock of the time_point, deduced from right
Duration2The duration type of the time_point, deduced from right
Parameters
leftThe duration to be added
rightThe time_point to be added
Returns
A time point representing right shifted by left

◆ operator+() [2/3]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator+ ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> std::common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
constexprnoexcept

Addition operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
A duration representing the sum of the two durations

◆ operator+() [3/3]

template<class Clock, class Duration1, class Rep2, class Period2>
auto std::chrono::operator+ ( time_point< Clock, Duration1 > const & left,
duration< Rep2, Period2 > const & right ) -> time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
constexprnoexcept

Add a time_point to a duration when the two are compatible.

Template Parameters
ClockThe clock of the time_point, deduced from left
Duration1The duration type of the time_point, deduced from left
Rep2The arithmetic representation of the duration, deduced from right
Period2The tick period of the duration, deduced from right
Parameters
leftThe time_point to be added
rightThe duration to be added
Returns
A time point representing left shifted by right

◆ operator-() [1/3]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator- ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> std::common_type_t<duration<Rep1, Period1>, duration<Rep2, Period2>>
constexprnoexcept

Subtraction operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
A duration representing the difference of the two durations

◆ operator-() [2/3]

template<class Clock, class Duration1, class Rep2, class Period2>
auto std::chrono::operator- ( time_point< Clock, Duration1 > const & left,
duration< Rep2, Period2 > const & right ) -> time_point<Clock, common_type_t<Duration1, duration<Rep2, Period2>>>
constexprnoexcept

Subtract a duration from a time_point when the two are compatible.

Template Parameters
ClockThe clock of the time_point, deduced from left
Duration1The duration type of the time_point, deduced from left
Rep2The arithmetic representation of the duration, deduced from right
Period2The tick period of the duration, deduced from right
Parameters
leftThe time_point to be subtracted from
rightThe duration to be subtracted
Returns
A time point representing left shifted by the inverse of right

◆ operator-() [3/3]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator- ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> common_type_t<Duration1, Duration2>
constexprnoexcept

Get the duration between two time_points when the two are compatible.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point, where the return value is "duration from here"
rightThe second time_point, where the return value is "duration to here"
Returns
A duration representing the time from left to right

◆ operator/() [1/2]

template<typename Rep1, typename Period, typename Rep2, arene::base::constraints< enable_if_t< is_convertible_v< Rep2, std::common_type_t< Rep1, Rep2 > > >, enable_if_t<!::arene::base::is_instantiation_of_v< Rep2, duration > > > = nullptr>
auto std::chrono::operator/ ( duration< Rep1, Period > const & dur,
Rep2 const & scalar ) -> duration<std::common_type_t<Rep1, Rep2>, Period>
constexprnoexcept

Division operator for duration and scalar.

Template Parameters
Rep1Representation type of the duration
PeriodPeriod type of the duration
Rep2Type of the scalar
Parameters
durThe duration
scalarThe scalar
Returns
A duration representing the duration divided by the scalar

◆ operator/() [2/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator/ ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> std::common_type_t<Rep1, Rep2>
constexprnoexcept

Division operator for two durations.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
The ratio of the two durations as a scalar

◆ operator<() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator< ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Less-than comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if lhs represents a shorter time interval than rhs, false otherwise

◆ operator<() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator< ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for ordering if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left refers to a time point earlier than right, otherwise false

◆ operator<=() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator<= ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Less-than-or-equal comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if lhs represents a shorter or equal time interval than rhs, false otherwise

◆ operator<=() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator<= ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for ordering if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left refers to a time point no later than right, otherwise false

◆ operator==() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator== ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Equality comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if the durations represent the same time interval, false otherwise

◆ operator==() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator== ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for equality if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left and right refer to the same time point, otherwise false

◆ operator>() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator> ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Greater-than comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if lhs represents a longer time interval than rhs, false otherwise

◆ operator>() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator> ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for ordering if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left refers to a time point later than right, otherwise false

◆ operator>=() [1/2]

template<typename Rep1, typename Period1, typename Rep2, typename Period2>
auto std::chrono::operator>= ( duration< Rep1, Period1 > const & lhs,
duration< Rep2, Period2 > const & rhs ) -> bool
constexprnoexcept

Greater-than-or-equal comparison operator for duration types.

Template Parameters
Rep1Representation type of the first duration
Period1Period type of the first duration
Rep2Representation type of the second duration
Period2Period type of the second duration
Parameters
lhsLeft-hand side duration
rhsRight-hand side duration
Returns
True if lhs represents a longer or equal time interval than rhs, false otherwise

◆ operator>=() [2/2]

template<class Clock, class Duration1, class Duration2>
auto std::chrono::operator>= ( time_point< Clock, Duration1 > const & left,
time_point< Clock, Duration2 > const & right ) -> bool
constexprnoexcept

Compare two time points for ordering if they're both from the same clock.

Template Parameters
ClockThe clock shared by both time_points, deduced from left and right
Duration1The duration type of the first time_point, deduced from left
Duration2The duration type of the second time_point, deduced from right
Parameters
leftThe first time_point
rightThe second time_point
Returns
true if left refers to a time point no earlier than right, otherwise false

◆ time_point_cast()

template<class ToDuration, class Clock, class Duration, arene::base::constraints< enable_if_t<::arene::base::is_instantiation_of_v< ToDuration, duration > > > = nullptr>
auto std::chrono::time_point_cast ( time_point< Clock, Duration > const & point) -> time_point<Clock, ToDuration>
constexprnoexcept

Cast a time_point into another type with the same clock but a different duration type.

Template Parameters
ToDurationThe duration type to be used after the cast
ClockThe clock of the time_point, deduced from point
DurationThe duration type of the existing time_point, deduced from point
Parameters
pointThe time point to cast to the new duration ToDuration
Returns
A representation of the same time point represented by point, but using duration type ToDuration

Variable Documentation

◆ treat_as_floating_point_v

template<typename Rep>
bool std::chrono::treat_as_floating_point_v = treat_as_floating_point<Rep>::value
constexpr

Helper variable template for treat_as_floating_point.

Template Parameters
RepThe representation type to check