tempoch-cpp 0.5.5
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_t & c_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< TargetScale > to () 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< TargetScale > to () const =delete
template<typename TargetScale, std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
Time< TargetScale > to_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, TargetFormat > to () const
template<typename TargetScale, typename TargetFormat, std::enable_if_t< is_scale_v< TargetScale > &&is_format_v< TargetFormat >, int > = 0>
EncodedTime< TargetScale, TargetFormat > to_with (const TimeContext &ctx) const
template<typename TargetFormat, std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > to () const
template<typename TargetFormat, std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > to_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>
Time & operator+= (const Q &delta)
template<typename Q>
Time & operator-= (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 char * label ()
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>
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>
Time tempoch::Time< S >::from_civil ( const CivilTime< S > & civil,
const TimeContext & ctx )
inlinestatic

◆ from_encoded()

◆ from_encoded_with()

template<typename S>
template<typename Fmt>
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::detail::decode_time(), EncodedTime, tempoch::TimeContext::get(), Time, and tempoch::EncodedTime< S, F >::value().

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

◆ from_raw_j2000_seconds()

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

Definition at line 163 of file time_base.hpp.

References from_split_seconds(), and Time.

◆ from_split_seconds()

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

Definition at line 159 of file time_base.hpp.

References tempoch::detail::make_time(), and Time.

Referenced by tempoch::from_gnss_week(), and from_raw_j2000_seconds().

◆ label()

template<typename S>
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 Time.

◆ operator+()

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

Definition at line 269 of file time_base.hpp.

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

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 Time.

◆ 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 TargetFormat, std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > tempoch::Time< S >::to ( ) const
inline

◆ to() [2/4]

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

Definition at line 229 of file time_base.hpp.

References EncodedTime, and to().

◆ to() [3/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::detail::scale_convert(), and Time.

Referenced by to().

◆ 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

References Time.

◆ 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::TimeContext::get(), and tempoch::detail::time_to_civil().

◆ to_with() [1/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

◆ to_with() [2/3]

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

Definition at line 235 of file time_base.hpp.

References EncodedTime, and to_with().

◆ to_with() [3/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::TimeContext::get(), tempoch::detail::scale_convert(), and Time.

Referenced by to_with(), and try_to().

◆ total_seconds()

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

Definition at line 180 of file time_base.hpp.

Referenced by tempoch::operator<<().

◆ try_to() [1/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 to_with().

◆ try_to() [2/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 to_with().

◆ EncodedTime

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

Definition at line 152 of file time_base.hpp.

References EncodedTime.

Referenced by EncodedTime, from_encoded(), from_encoded_with(), to(), and to_with().

◆ Time


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