4#ifndef TETL_CHRONO_TIME_POINT_HPP
5#define TETL_CHRONO_TIME_POINT_HPP
7#include <etl/_type_traits/common_type.hpp>
8#include <etl/_type_traits/is_convertible.hpp>
21template <
typename Clock,
typename Duration =
typename Clock::duration>
27 using duration = Duration;
31 using rep =
typename duration::rep;
35 using period =
typename duration::period;
44 constexpr explicit time_point(duration
const& d)
noexcept
53 template <
typename Dur2>
54 requires(is_convertible_v<Dur2, duration>)
56 : _d{t.time_since_epch()}
134template <
typename Clock,
typename Dur1,
typename Dur2>
138 return lhs.time_since_epoch() == rhs.time_since_epoch();
143template <
typename Clock,
typename Dur1,
typename Dur2>
147 return lhs.time_since_epoch() < rhs.time_since_epoch();
152template <
typename Clock,
typename Dur1,
typename Dur2>
156 return lhs.time_since_epoch() <= rhs.time_since_epoch();
161template <
typename Clock,
typename Dur1,
typename Dur2>
165 return lhs.time_since_epoch() > rhs.time_since_epoch();
170template <
typename Clock,
typename Dur1,
typename Dur2>
174 return lhs.time_since_epoch() >= rhs.time_since_epoch();
183template <
typename Clock,
typename Duration1,
typename Duration2>
185 using type =
chrono::
time_point<Clock, common_type_t<Duration1, Duration2>>;
constexpr auto operator>(time_point< Clock, Dur1 > const &lhs, time_point< Clock, Dur2 > const &rhs) noexcept -> bool
Compares two time points. The comparison is done by comparing the results time_since_epoch() for the ...
Definition time_point.hpp:162
constexpr auto operator<(time_point< Clock, Dur1 > const &lhs, time_point< Clock, Dur2 > const &rhs) noexcept -> bool
Compares two time points. The comparison is done by comparing the results time_since_epoch() for the ...
Definition time_point.hpp:144
constexpr auto operator<=(time_point< Clock, Dur1 > const &lhs, time_point< Clock, Dur2 > const &rhs) noexcept -> bool
Compares two time points. The comparison is done by comparing the results time_since_epoch() for the ...
Definition time_point.hpp:153
constexpr auto operator==(time_point< Clock, Dur1 > const &lhs, time_point< Clock, Dur2 > const &rhs) noexcept -> bool
Compares two time points. The comparison is done by comparing the results time_since_epoch() for the ...
Definition time_point.hpp:135
constexpr auto operator>=(time_point< Clock, Dur1 > const &lhs, time_point< Clock, Dur2 > const &rhs) noexcept -> bool
Compares two time points. The comparison is done by comparing the results time_since_epoch() for the ...
Definition time_point.hpp:171
Definition adjacent_find.hpp:9
Class template time_point represents a point in time. It is implemented as if it stores a value of ty...
Definition time_point.hpp:22
constexpr time_point(time_point< clock, Dur2 > const &t)
Constructs a new time_point from one of several optional data sources. Constructs a time_point by con...
Definition time_point.hpp:55
constexpr auto time_since_epoch() const noexcept -> duration
Returns a duration representing the amount of time between *this and the clock's epoch.
Definition time_point.hpp:62
static constexpr auto max() noexcept -> time_point
Returns a time_point with the largest possible duration,.
Definition time_point.hpp:123
constexpr time_point() noexcept=default
Constructs a new time_point from one of several optional data sources. Default constructor,...
static constexpr auto min() noexcept -> time_point
Returns a time_point with the smallest possible duration,.
Definition time_point.hpp:117
constexpr auto operator++(int) noexcept -> time_point
Modifies the point in time *this represents by one tick of the duration.
Definition time_point.hpp:96
constexpr auto operator++() noexcept -> time_point &
Modifies the point in time *this represents by one tick of the duration.
Definition time_point.hpp:88
constexpr auto operator+=(duration const &d) noexcept -> time_point &
Modifies the time point by the given duration. Applies the offset d to pt. Effectively,...
Definition time_point.hpp:71
constexpr auto operator--() noexcept -> time_point &
Modifies the point in time *this represents by one tick of the duration.
Definition time_point.hpp:103
constexpr time_point(duration const &d) noexcept
Constructs a new time_point from one of several optional data sources. Constructs a time_point at Clo...
Definition time_point.hpp:44
constexpr auto operator--(int) noexcept -> time_point
Modifies the point in time *this represents by one tick of the duration.
Definition time_point.hpp:111
constexpr auto operator-=(duration const &d) noexcept -> time_point &
Modifies the time point by the given duration. Applies the offset d to pt in negative direction....
Definition time_point.hpp:80