Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
std::chrono::time_point< Clock, Duration > Class Template Reference

A class representing a single point in time for the given clock. More...

Public Types

using clock = Clock
 The clock on which this is a time point.
 
using duration = Duration
 A std::chrono::duration specialization to be used to represent the time since the clock's epoch.
 
using period = typename duration::period
 The period (length of one tick) used by duration, relative to 1 second.
 
using rep = typename duration::rep
 The underlying arithmetic type used to represent the time since the clock's epoch.
 

Public Member Functions

constexpr time_point () noexcept(noexcept(duration(duration::zero())))
 Default-construct a time_point referring to clock's epoch.
 
constexpr time_point (duration const &epoch_time) noexcept(is_nothrow_copy_constructible_v< duration >)
 Construct a time_point referring to the point a certain length of time after clock's epoch.
 
template<class Duration2, arene::base::constraints< enable_if_t< is_convertible_v< Duration2, duration > > > = nullptr>
constexpr time_point (time_point< clock, Duration2 > const &other) noexcept(is_nothrow_constructible_v< duration, Duration2 >)
 Implicitly convert a time_point for the same clock, potentially even if it has a different duration.
 
auto operator+= (duration const &dur) noexcept(noexcept(time_since_epoch_+=dur)) -> time_point &
 Move this time_point forward by a certain duration.
 
auto operator-= (duration const &dur) noexcept(noexcept(time_since_epoch_ -=dur)) -> time_point &
 Move this time_point backward by a certain duration.
 
constexpr auto time_since_epoch () const noexcept(is_nothrow_copy_constructible_v< duration >) -> duration
 Return the time of a particular time_point as the duration since its clock's epoch.
 

Static Public Member Functions

static constexpr auto max () noexcept(noexcept(time_point{duration::max()})) -> time_point
 Get the maximum time_point representable by this class.
 
static constexpr auto min () noexcept(noexcept(time_point{duration::min()})) -> time_point
 Get the minimum time_point representable by this class.
 

Detailed Description

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

A class representing a single point in time for the given clock.

Template Parameters
ClockThe clock on which this is a time point
DurationThe type representing time since the clock's epoch; must be an instance of std::chrono::duration

Member Typedef Documentation

◆ clock

template<class Clock, class Duration = typename Clock::duration>
using std::chrono::time_point< Clock, Duration >::clock = Clock

The clock on which this is a time point.

◆ duration

template<class Clock, class Duration = typename Clock::duration>
using std::chrono::time_point< Clock, Duration >::duration = Duration

A std::chrono::duration specialization to be used to represent the time since the clock's epoch.

◆ period

template<class Clock, class Duration = typename Clock::duration>
using std::chrono::time_point< Clock, Duration >::period = typename duration::period

The period (length of one tick) used by duration, relative to 1 second.

◆ rep

template<class Clock, class Duration = typename Clock::duration>
using std::chrono::time_point< Clock, Duration >::rep = typename duration::rep

The underlying arithmetic type used to represent the time since the clock's epoch.

Constructor & Destructor Documentation

◆ time_point() [1/3]

template<class Clock, class Duration = typename Clock::duration>
std::chrono::time_point< Clock, Duration >::time_point ( )
inlineconstexprnoexcept

Default-construct a time_point referring to clock's epoch.

◆ time_point() [2/3]

template<class Clock, class Duration = typename Clock::duration>
std::chrono::time_point< Clock, Duration >::time_point ( duration const & epoch_time)
inlineexplicitconstexprnoexcept

Construct a time_point referring to the point a certain length of time after clock's epoch.

Parameters
epoch_timeThe amount of time after clock's epoch which the new time_point will represent

◆ time_point() [3/3]

template<class Clock, class Duration = typename Clock::duration>
template<class Duration2, arene::base::constraints< enable_if_t< is_convertible_v< Duration2, duration > > > = nullptr>
std::chrono::time_point< Clock, Duration >::time_point ( time_point< clock, Duration2 > const & other)
inlineconstexprnoexcept

Implicitly convert a time_point for the same clock, potentially even if it has a different duration.

Template Parameters
Duration2The duration representation for the other time point; must be convertible to duration
Parameters
otherThe time point to convert

Member Function Documentation

◆ max()

template<class Clock, class Duration = typename Clock::duration>
static constexpr auto std::chrono::time_point< Clock, Duration >::max ( ) -> time_point
inlinestaticconstexprnoexcept

Get the maximum time_point representable by this class.

Returns
The time_point corresponding to the latest representable time

◆ min()

template<class Clock, class Duration = typename Clock::duration>
static constexpr auto std::chrono::time_point< Clock, Duration >::min ( ) -> time_point
inlinestaticconstexprnoexcept

Get the minimum time_point representable by this class.

Returns
The time_point corresponding to the earliest representable time

◆ operator+=()

template<class Clock, class Duration = typename Clock::duration>
auto std::chrono::time_point< Clock, Duration >::operator+= ( duration const & dur) -> time_point&
inlinenoexcept

Move this time_point forward by a certain duration.

Parameters
durThe duration to move forward by
Note
May overflow if duration::operator+= can overflow

◆ operator-=()

template<class Clock, class Duration = typename Clock::duration>
auto std::chrono::time_point< Clock, Duration >::operator-= ( duration const & dur) -> time_point&
inlinenoexcept

Move this time_point backward by a certain duration.

Parameters
durThe duration to move backward by
Note
May underflow if duration::operator-= can underflow

◆ time_since_epoch()

template<class Clock, class Duration = typename Clock::duration>
auto std::chrono::time_point< Clock, Duration >::time_since_epoch ( ) const -> duration
inlineconstexprnoexcept

Return the time of a particular time_point as the duration since its clock's epoch.

Returns
The time between this time_point and clock's epoch

The documentation for this class was generated from the following file: