tempoch-cpp 0.5.3
Header-only C++ wrapper for tempoch
Loading...
Searching...
No Matches
tempoch::Time< S > Class Template Reference

A point in time on scale S, stored as a split J2000-second pair. More...

#include <tempoch/time_base.hpp>

Public Types

using scale_type = S
 

Public Member Functions

 Time ()
 
std::pair< qtty::Second, qtty::Second > split_seconds () const noexcept
 
qtty::Second total_seconds () const noexcept
 
const tempoch_time_tc_inner () const noexcept
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
CivilTime to_civil () const
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
CivilTime to_civil (const TimeContext &ctx) const
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale > &&!std::is_same_v< S, scale::UT1 > &&!std::is_same_v< TargetScale, scale::UT1 >, int > = 0>
Time< TargetScaleto () const
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale > &&(std::is_same_v< S, scale::UT1 >||std::is_same_v< TargetScale, scale::UT1 >), int > = 0>
Time< TargetScaleto () const =delete
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
Time< TargetScaleto_with (const TimeContext &ctx) const
 
template<typename TargetScale , typename TargetFormat , std::enable_if_t< is_scale_v< TargetScale > &&is_format_v< TargetFormat >, int > = 0>
EncodedTime< TargetScale, TargetFormatto () const
 
template<typename TargetScale , typename TargetFormat , std::enable_if_t< is_scale_v< TargetScale > &&is_format_v< TargetFormat >, int > = 0>
EncodedTime< TargetScale, TargetFormatto_with (const TimeContext &ctx) const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormatto () const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormatto_with (const TimeContext &ctx) const
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
std::optional< Time< TargetScale > > try_to () const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
std::optional< EncodedTime< S, TargetFormat > > try_to () const
 
template<typename Q >
Time operator+ (const Q &delta) const
 
template<typename Q >
Time operator- (const Q &delta) const
 
template<typename Q >
Timeoperator+= (const Q &delta)
 
template<typename Q >
Timeoperator-= (const Q &delta)
 
qtty::Second operator- (const Time &other) const
 
bool operator== (const Time &other) const noexcept
 
bool operator!= (const Time &other) const noexcept
 
bool operator< (const Time &other) const noexcept
 
bool operator<= (const Time &other) const noexcept
 
bool operator> (const Time &other) const noexcept
 
bool operator>= (const Time &other) const noexcept
 

Static Public Member Functions

static Time from_split_seconds (qtty::Second hi, qtty::Second lo=qtty::Second(0.0))
 
static Time from_raw_j2000_seconds (qtty::Second seconds)
 
template<typename Fmt >
static Time from_encoded (const EncodedTime< S, Fmt > &encoded)
 Decode a scalar encoding Fmt into canonical split storage on scale S (default context).
 
template<typename Fmt >
static Time from_encoded_with (const EncodedTime< S, Fmt > &encoded, const TimeContext &ctx)
 Decode using explicit UTC / UT1 policy from ctx when required by format Fmt.
 
static constexpr const charlabel ()
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
static Time from_civil (const CivilTime &civil)
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
static Time from_civil (const CivilTime &civil, const TimeContext &ctx)
 

Friends

template<typename >
class Time
 
template<typename , typename >
class EncodedTime
 

Detailed Description

template<typename S>
class tempoch::Time< S >

A point in time on scale S, stored as a split J2000-second pair.

Definition at line 144 of file time_base.hpp.

Member Typedef Documentation

◆ scale_type

template<typename S >
using tempoch::Time< S >::scale_type = S

Definition at line 155 of file time_base.hpp.

Constructor & Destructor Documentation

◆ Time()

template<typename S >
tempoch::Time< S >::Time ( )
inline

Definition at line 157 of file time_base.hpp.

Member Function Documentation

◆ c_inner()

template<typename S >
const tempoch_time_t & tempoch::Time< S >::c_inner ( ) const
inlinenoexcept

Definition at line 184 of file time_base.hpp.

Referenced by tempoch::to_gnss_week().

◆ from_civil() [1/2]

template<typename S >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
static Time tempoch::Time< S >::from_civil ( const CivilTime< S > &  civil)
inlinestatic

◆ from_civil() [2/2]

template<typename S >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
static Time tempoch::Time< S >::from_civil ( const CivilTime< S > &  civil,
const TimeContext ctx 
)
inlinestatic

◆ from_encoded()

template<typename S >
template<typename Fmt >
static Time tempoch::Time< S >::from_encoded ( const EncodedTime< S, Fmt > &  encoded)
inlinestatic

◆ from_encoded_with()

template<typename S >
template<typename Fmt >
static Time tempoch::Time< S >::from_encoded_with ( const EncodedTime< S, Fmt > &  encoded,
const TimeContext ctx 
)
inlinestatic

Decode using explicit UTC / UT1 policy from ctx when required by format Fmt.

Definition at line 172 of file time_base.hpp.

References tempoch::scale_tag_v, and tempoch::Time< S >::Time.

Referenced by tempoch::EncodedTime< S, F >::to_utc(), and tempoch::EncodedTime< S, F >::to_with().

◆ from_raw_j2000_seconds()

template<typename S >
static Time tempoch::Time< S >::from_raw_j2000_seconds ( qtty::Second  seconds)
inlinestatic

◆ from_split_seconds()

template<typename S >
static Time tempoch::Time< S >::from_split_seconds ( qtty::Second  hi,
qtty::Second  lo = qtty::Second(0.0) 
)
inlinestatic

◆ label()

template<typename S >
static constexpr const char * tempoch::Time< S >::label ( )
inlinestaticconstexpr

Definition at line 186 of file time_base.hpp.

◆ operator!=()

template<typename S >
bool tempoch::Time< S >::operator!= ( const Time< S > &  other) const
inlinenoexcept

Definition at line 293 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator+()

template<typename S >
template<typename Q >
Time tempoch::Time< S >::operator+ ( const Q delta) const
inline

◆ operator+=()

template<typename S >
template<typename Q >
Time & tempoch::Time< S >::operator+= ( const Q delta)
inline

Definition at line 275 of file time_base.hpp.

References tempoch::detail::add_seconds(), and tempoch::scale_tag_v.

◆ operator-() [1/2]

template<typename S >
template<typename Q >
Time tempoch::Time< S >::operator- ( const Q delta) const
inline

Definition at line 273 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator-() [2/2]

template<typename S >
qtty::Second tempoch::Time< S >::operator- ( const Time< S > &  other) const
inline

Definition at line 285 of file time_base.hpp.

References tempoch::detail::difference_seconds(), and tempoch::scale_tag_v.

◆ operator-=()

template<typename S >
template<typename Q >
Time & tempoch::Time< S >::operator-= ( const Q delta)
inline

Definition at line 280 of file time_base.hpp.

References tempoch::detail::add_seconds(), and tempoch::scale_tag_v.

◆ operator<()

template<typename S >
bool tempoch::Time< S >::operator< ( const Time< S > &  other) const
inlinenoexcept

Definition at line 295 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator<=()

template<typename S >
bool tempoch::Time< S >::operator<= ( const Time< S > &  other) const
inlinenoexcept

Definition at line 300 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator==()

template<typename S >
bool tempoch::Time< S >::operator== ( const Time< S > &  other) const
inlinenoexcept

Definition at line 289 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator>()

template<typename S >
bool tempoch::Time< S >::operator> ( const Time< S > &  other) const
inlinenoexcept

Definition at line 301 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator>=()

template<typename S >
bool tempoch::Time< S >::operator>= ( const Time< S > &  other) const
inlinenoexcept

Definition at line 302 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ split_seconds()

template<typename S >
std::pair< qtty::Second, qtty::Second > tempoch::Time< S >::split_seconds ( ) const
inlinenoexcept

Definition at line 176 of file time_base.hpp.

◆ to() [1/4]

template<typename S >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale > &&!std::is_same_v< S, scale::UT1 > &&!std::is_same_v< TargetScale, scale::UT1 >, int > = 0>
Time< TargetScale > tempoch::Time< S >::to ( ) const
inline

Definition at line 212 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to() [2/4]

template<typename S >
EncodedTime< TargetScale, TargetFormat > tempoch::Time< S >::to ( ) const
inline

Definition at line 229 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to() [3/4]

template<typename S >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > tempoch::Time< S >::to ( ) const
inline

Definition at line 240 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to() [4/4]

template<typename S >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale > &&(std::is_same_v< S, scale::UT1 >||std::is_same_v< TargetScale, scale::UT1 >), int > = 0>
Time< TargetScale > tempoch::Time< S >::to ( ) const
delete

◆ to_civil() [1/2]

template<typename S >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
CivilTime tempoch::Time< S >::to_civil ( ) const
inline

◆ to_civil() [2/2]

template<typename S >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::UTC >, int > = 0>
CivilTime tempoch::Time< S >::to_civil ( const TimeContext ctx) const
inline

Definition at line 204 of file time_base.hpp.

References tempoch::scale_tag_v, and tempoch::detail::time_to_civil().

◆ to_with() [1/3]

template<typename S >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
Time< TargetScale > tempoch::Time< S >::to_with ( const TimeContext ctx) const
inline

Definition at line 223 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to_with() [2/3]

template<typename S >
EncodedTime< TargetScale, TargetFormat > tempoch::Time< S >::to_with ( const TimeContext ctx) const
inline

Definition at line 235 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to_with() [3/3]

template<typename S >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > tempoch::Time< S >::to_with ( const TimeContext ctx) const
inline

Definition at line 246 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ total_seconds()

template<typename S >
qtty::Second tempoch::Time< S >::total_seconds ( ) const
inlinenoexcept

Definition at line 180 of file time_base.hpp.

◆ try_to() [1/2]

template<typename S >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
std::optional< Time< TargetScale > > tempoch::Time< S >::try_to ( ) const
inline

Definition at line 252 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ try_to() [2/2]

template<typename S >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
std::optional< EncodedTime< S, TargetFormat > > tempoch::Time< S >::try_to ( ) const
inline

Definition at line 261 of file time_base.hpp.

References tempoch::scale_tag_v.

Friends And Related Symbol Documentation

◆ EncodedTime

template<typename S >
template<typename , typename >
friend class EncodedTime
friend

Definition at line 152 of file time_base.hpp.

◆ Time


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