Sen API
Sen Libraries
Loading...
Searching...
No Matches
sen::TimeStamp Class Reference

A point in time. More...

#include <timestamp.h>

Public Types

using ValueType = Duration::ValueType

Public Member Functions

constexpr TimeStamp () noexcept=default
constexpr TimeStamp (Duration timeSinceEpoch) noexcept
 ~TimeStamp () noexcept=default
constexpr Duration sinceEpoch () const noexcept
 Time passed since 1 January 1970 UTC.
constexpr bool operator== (const TimeStamp &other) const noexcept
 Compares two Timestamps to determine if they are equal.
constexpr bool operator!= (const TimeStamp &other) const noexcept
 Compares two Timestamps to determine if they are not equal.
constexpr bool operator< (const TimeStamp &other) const noexcept
 True if *this is less than other.
constexpr bool operator<= (const TimeStamp &other) const noexcept
 True if *this is less or equal than other.
constexpr bool operator> (const TimeStamp &other) const noexcept
 True if *this is greater than other.
constexpr bool operator>= (const TimeStamp &other) const noexcept
 True if *this is greater or equal than other.
TimeStampoperator+= (const Duration &other) noexcept
 Adds other to *this and returns *this.
constexpr TimeStamp operator+ (const Duration &other) const noexcept
 Returns a TimeStamp of *this + other.
TimeStampoperator-= (const Duration &other) noexcept
 Removes other from *this and returns *this.
constexpr TimeStamp operator- (const Duration &other) const noexcept
 Returns a TimeStamp of *this - other.
constexpr Duration operator- (const TimeStamp &other) const noexcept
 Returns a Duration of *this - other.
std::string toUtcString () const
 UTC string representation of this time point.
std::string toLocalString () const
 Local string representation of this time point.

Static Public Member Functions

static Result< TimeStamp, std::string > make (const std::string_view iso8601Time)

Detailed Description

A point in time.

Member Typedef Documentation

◆ ValueType

Constructor & Destructor Documentation

◆ TimeStamp() [1/2]

sen::TimeStamp::TimeStamp ( )
constexprdefaultnoexcept

◆ TimeStamp() [2/2]

sen::TimeStamp::TimeStamp ( Duration timeSinceEpoch)
inlineexplicitconstexprnoexcept

◆ ~TimeStamp()

sen::TimeStamp::~TimeStamp ( )
defaultnoexcept

Member Function Documentation

◆ make()

Result< TimeStamp, std::string > sen::TimeStamp::make ( const std::string_view iso8601Time)
static

◆ sinceEpoch()

Duration sen::TimeStamp::sinceEpoch ( ) const
inlinenodiscardconstexprnoexcept

Time passed since 1 January 1970 UTC.

◆ operator==()

bool sen::TimeStamp::operator== ( const TimeStamp & other) const
inlineconstexprnoexcept

Compares two Timestamps to determine if they are equal.

◆ operator!=()

bool sen::TimeStamp::operator!= ( const TimeStamp & other) const
inlineconstexprnoexcept

Compares two Timestamps to determine if they are not equal.

◆ operator<()

bool sen::TimeStamp::operator< ( const TimeStamp & other) const
inlineconstexprnoexcept

True if *this is less than other.

◆ operator<=()

bool sen::TimeStamp::operator<= ( const TimeStamp & other) const
inlineconstexprnoexcept

True if *this is less or equal than other.

◆ operator>()

bool sen::TimeStamp::operator> ( const TimeStamp & other) const
inlineconstexprnoexcept

True if *this is greater than other.

◆ operator>=()

bool sen::TimeStamp::operator>= ( const TimeStamp & other) const
inlineconstexprnoexcept

True if *this is greater or equal than other.

◆ operator+=()

TimeStamp & sen::TimeStamp::operator+= ( const Duration & other)
inlinenoexcept

Adds other to *this and returns *this.

◆ operator+()

TimeStamp sen::TimeStamp::operator+ ( const Duration & other) const
inlineconstexprnoexcept

Returns a TimeStamp of *this + other.

◆ operator-=()

TimeStamp & sen::TimeStamp::operator-= ( const Duration & other)
inlinenoexcept

Removes other from *this and returns *this.

◆ operator-() [1/2]

TimeStamp sen::TimeStamp::operator- ( const Duration & other) const
inlineconstexprnoexcept

Returns a TimeStamp of *this - other.

◆ operator-() [2/2]

Duration sen::TimeStamp::operator- ( const TimeStamp & other) const
inlineconstexprnoexcept

Returns a Duration of *this - other.

◆ toUtcString()

std::string sen::TimeStamp::toUtcString ( ) const
nodiscard

UTC string representation of this time point.

◆ toLocalString()

std::string sen::TimeStamp::toLocalString ( ) const
nodiscard

Local string representation of this time point.


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