tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
time_point< Clock, Duration > Struct Template Reference

Class template time_point represents a point in time. It is implemented as if it stores a value of type Duration indicating the time interval from the start of the Clock's epoch. More...

#include <time_point.hpp>

Public Types

using clock = Clock
 Clock, the clock on which this time point is measured.
 
using duration = Duration
 Duration, a duration type used to measure the time since epoch.
 
using period = typename duration::period
 Period, a ratio type representing the tick period of the duration.
 
using rep = typename duration::rep
 Rep, an arithmetic type representing the number of ticks of the duration.
 

Public Member Functions

constexpr time_point () noexcept=default
 Constructs a new time_point from one of several optional data sources. Default constructor, creates a time_point representing the Clock's epoch (i.e., time_since_epoch() is zero).
 
constexpr time_point (duration const &d) noexcept
 Constructs a new time_point from one of several optional data sources. Constructs a time_point at Clock's epoch plus d.
 
template<typename Dur2>
requires (is_convertible_v<Dur2, duration>)
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 converting t to duration. This constructor only participates in overload resolution if Duration2 is implicitly convertible to duration.
 
constexpr auto operator++ () noexcept -> time_point &
 Modifies the point in time *this represents by one tick of the duration.
 
constexpr auto operator++ (int) noexcept -> time_point
 Modifies the point in time *this represents by one tick of the duration.
 
constexpr auto operator+= (duration const &d) noexcept -> time_point &
 Modifies the time point by the given duration. Applies the offset d to pt. Effectively, d is added to the internally stored duration d_ as d_ += d.
 
constexpr auto operator-- () noexcept -> time_point &
 Modifies the point in time *this represents by one tick of the duration.
 
constexpr auto operator-- (int) noexcept -> time_point
 Modifies the point in time *this represents by one tick of the duration.
 
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. Effectively, d is subtracted from internally stored duration d_ as d_ -= d.
 
constexpr auto time_since_epoch () const noexcept -> duration
 Returns a duration representing the amount of time between *this and the clock's epoch.
 

Static Public Member Functions

static constexpr auto max () noexcept -> time_point
 Returns a time_point with the largest possible duration,.
 
static constexpr auto min () noexcept -> time_point
 Returns a time_point with the smallest possible duration,.
 

Detailed Description

template<typename Clock, typename Duration = typename Clock::duration>
struct etl::chrono::time_point< Clock, Duration >

Class template time_point represents a point in time. It is implemented as if it stores a value of type Duration indicating the time interval from the start of the Clock's epoch.

Template Parameters
ClockMust meet the requirements for Clock

https://en.cppreference.com/w/cpp/named_req/Clock

Member Typedef Documentation

◆ clock

template<typename Clock, typename Duration = typename Clock::duration>
using clock = Clock

Clock, the clock on which this time point is measured.

◆ duration

template<typename Clock, typename Duration = typename Clock::duration>
using duration = Duration

Duration, a duration type used to measure the time since epoch.

◆ period

template<typename Clock, typename Duration = typename Clock::duration>
using period = typename duration::period

Period, a ratio type representing the tick period of the duration.

◆ rep

template<typename Clock, typename Duration = typename Clock::duration>
using rep = typename duration::rep

Rep, an arithmetic type representing the number of ticks of the duration.

Constructor & Destructor Documentation

◆ time_point() [1/3]

template<typename Clock, typename Duration = typename Clock::duration>
time_point ( )
constexprdefaultnoexcept

Constructs a new time_point from one of several optional data sources. Default constructor, creates a time_point representing the Clock's epoch (i.e., time_since_epoch() is zero).

◆ time_point() [2/3]

template<typename Clock, typename Duration = typename Clock::duration>
time_point ( duration const & d)
inlineexplicitconstexprnoexcept

Constructs a new time_point from one of several optional data sources. Constructs a time_point at Clock's epoch plus d.

◆ time_point() [3/3]

template<typename Clock, typename Duration = typename Clock::duration>
template<typename Dur2>
requires (is_convertible_v<Dur2, duration>)
time_point ( time_point< clock, Dur2 > const & t)
inlineconstexpr

Constructs a new time_point from one of several optional data sources. Constructs a time_point by converting t to duration. This constructor only participates in overload resolution if Duration2 is implicitly convertible to duration.

Member Function Documentation

◆ max()

template<typename Clock, typename Duration = typename Clock::duration>
constexpr auto max ( ) -> time_point
inlinestaticnodiscardconstexprnoexcept

Returns a time_point with the largest possible duration,.

◆ min()

template<typename Clock, typename Duration = typename Clock::duration>
constexpr auto min ( ) -> time_point
inlinestaticnodiscardconstexprnoexcept

Returns a time_point with the smallest possible duration,.

◆ operator++() [1/2]

template<typename Clock, typename Duration = typename Clock::duration>
auto operator++ ( ) -> time_point&
inlineconstexprnoexcept

Modifies the point in time *this represents by one tick of the duration.

◆ operator++() [2/2]

template<typename Clock, typename Duration = typename Clock::duration>
auto operator++ ( int ) -> time_point
inlineconstexprnoexcept

Modifies the point in time *this represents by one tick of the duration.

◆ operator+=()

template<typename Clock, typename Duration = typename Clock::duration>
auto operator+= ( duration const & d) -> time_point&
inlineconstexprnoexcept

Modifies the time point by the given duration. Applies the offset d to pt. Effectively, d is added to the internally stored duration d_ as d_ += d.

◆ operator--() [1/2]

template<typename Clock, typename Duration = typename Clock::duration>
auto operator-- ( ) -> time_point&
inlineconstexprnoexcept

Modifies the point in time *this represents by one tick of the duration.

◆ operator--() [2/2]

template<typename Clock, typename Duration = typename Clock::duration>
auto operator-- ( int ) -> time_point
inlineconstexprnoexcept

Modifies the point in time *this represents by one tick of the duration.

◆ operator-=()

template<typename Clock, typename Duration = typename Clock::duration>
auto operator-= ( duration const & d) -> time_point&
inlineconstexprnoexcept

Modifies the time point by the given duration. Applies the offset d to pt in negative direction. Effectively, d is subtracted from internally stored duration d_ as d_ -= d.

◆ time_since_epoch()

template<typename Clock, typename Duration = typename Clock::duration>
auto time_since_epoch ( ) const -> duration
inlinenodiscardconstexprnoexcept

Returns a duration representing the amount of time between *this and the clock's epoch.


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