time_point Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at time_point Class.

A time_point describes a type that represents a point in time. It holds an object of type duration that stores the elapsed time since the epoch that is represented by the template argument Clock.

template <class Clock,  
    class Duration = typename Clock::duration>  
class time_point;  

Public Typedefs

NameDescription
time_point::clockSynonym for the template parameter Clock.
time_point::durationSynonym for the template parameter Duration.
time_point::periodSynonym for the nested type name duration::period.
time_point::repSynonym for the nested type name duration::rep.

Public Constructors

NameDescription
time_point::time_point ConstructorConstructs a time_point object.

Public Methods

NameDescription
time_point::max MethodSpecifies the upper limit for time_point::ref.
time_point::min MethodSpecifies the lower limit for time_point::ref.
time_point::time_since_epoch MethodReturns the stored duration value.

Public Operators

NameDescription
time_point::operator+=Adds a specified value to the stored duration.
time_point::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 time_point::ref.

static constexpr time_point max();

Return Value

In effect, returns time_point(duration::max()).

Static method that returns the lower bound for values of type time_point::ref.

static constexpr time_point min();

Return Value

In effect, returns time_point(duration::min()).

Adds a specified value to the stored duration value.

time_point& operator+=(const duration& Dur);

Parameters

Dur
A duration object.

Return Value

The time_point object after the addition is performed.

Subtracts a specified value from the stored duration value.

time_point& operator-=(const duration& Dur);

Parameters

Dur
A duration object.

Return Value

The time_point object after the subtraction is performed.

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);

Parameters

Dur
A duration object.

Tp
A time_point object.

Remarks

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 does not participate in overload resolution. For more information, see <type_traits>.

The third constructor initializes its duration value by using Tp.time_since_epoch().

Retrieves the stored duration value.

constexpr duration time_since_epoch() const;

Header Files Reference
<chrono>

Show: