| description | Learn more about: time_point Class | ||||||
|---|---|---|---|---|---|---|---|
| title | time_point Class | ||||||
| ms.date | 01/05/2022 | ||||||
| f1_keywords |
|
||||||
| helpviewer_keywords |
|
||||||
| dev_langs |
|
A time_point represents a point in time that is relative to the epoch of a clock.
template <class Clock, class Duration = typename Clock::duration>
class time_point;The clock that supplies the reference point for the epoch is specified by the template argument Clock.
| Name | Description |
|---|---|
clock |
Synonym for the template parameter Clock. |
duration |
Synonym for the template parameter Duration. |
period |
Synonym for the nested type name duration::period. |
rep |
Synonym for the nested type name duration::rep. |
| Name | Description |
|---|---|
time_point |
Constructs a time_point object. |
| Name | Description |
|---|---|
max |
Specifies the upper limit for rep. |
min |
Specifies the lower limit for rep. |
time_since_epoch |
Returns the amount of time between this time_point and the clock's epoch (or time and date that the clock starts measuring time). |
| Name | Description |
|---|---|
operator+= |
Adds a specified value to the stored duration. |
operator-= |
Subtracts a specified value from the stored duration. |
Header: <chrono>
Namespace: std::chrono
Static method that returns the upper bound for values of type rep.
static constexpr time_point max();In effect, returns time_point(duration::max()).
Static method that returns the lower bound for values of type rep.
static constexpr time_point min();In effect, returns time_point(duration::min()).
Adds a specified value to the stored duration value.
time_point& operator+=(const duration& Dur);Dur
A duration object.
The time_point object after the addition is done.
Subtracts a specified value from the stored duration value.
time_point& operator-=(const duration& Dur);Dur
A duration object.
The time_point object after the subtraction is done.
Constructs a time_point object.
constexpr time_point();
constexpr explicit time_point(const duration& Dur);
template <class Duration2>
constexpr time_point(const time_point<clock, Duration2>& Tp);Dur
A duration object.
Tp
A time_point object.
The first constructor constructs an object whose stored duration value is equal to duration::zero.
The second constructor constructs an object whose stored duration value is equal to Dur. Unless is_convertible<Duration2, duration> holds true, the second constructor doesn't participate in overload resolution. For more information, see <type_traits>.
The third constructor initializes its duration value by using Tp.time_since_epoch().
Returns the amount of time between this time_point and the clock's epoch. (A clock's epoch is the time from which the clock starts measuring time, such as midnight 1/1/1970). It's returned as a duration value.
constexpr duration time_since_epoch() const;