ORIGINAL
Loading...
Searching...
No Matches
original::time::point Class Referencefinal

Represents a point in time with nanosecond precision. More...

#include <zeit.h>

Inheritance diagram for original::time::point:
Inheritance graph
Collaboration diagram for original::time::point:
Collaboration graph

Public Member Functions

 point (time_val_type val=0, unit unit=MILLISECOND)
 Constructs time point from value and unit.
 
 point (duration d)
 Constructs time point from duration.
 
time_val_type value (unit unit=MILLISECOND) const noexcept
 Gets time value in specified units.
 
integer compareTo (const point &other) const override
 Compares this time point to another.
 
u_integer toHash () const noexcept override
 Computes hash value for this time point.
 
std::string className () const override
 Gets the class name.
 
std::string toString (bool enter) const override
 Converts time point to string representation.
 
pointoperator++ ()
 Prefix increment (adds 1 nanosecond)
 
point operator++ (int postfix)
 Postfix increment (adds 1 nanosecond)
 
pointoperator-- ()
 Prefix decrement (subtracts 1 nanosecond)
 
point operator-- (int postfix)
 Postfix decrement (subtracts 1 nanosecond)
 
pointoperator+= (const duration &d)
 Adds duration to time point.
 
pointoperator-= (const duration &d)
 Subtracts duration from time point.
 
- Public Member Functions inherited from original::comparable< point >
virtual integer compareTo (const point &other) const=0
 Compares the current object with another of the same type.
 
bool operator== (const point &other) const
 Checks if the current object is equal to another.
 
bool operator!= (const point &other) const
 Checks if the current object is not equal to another.
 
bool operator< (const point &other) const
 Checks if the current object is less than another.
 
bool operator> (const point &other) const
 Checks if the current object is greater than another.
 
bool operator<= (const point &other) const
 Checks if the current object is less than or equal to another.
 
bool operator>= (const point &other) const
 Checks if the current object is greater than or equal to another.
 
virtual ~comparable ()=default
 Virtual destructor for proper cleanup of derived objects.
 
- Public Member Functions inherited from original::hashable< point >
virtual bool equals (const point &other) const noexcept
 Compares two objects for equality.
 
virtual ~hashable ()=0
 Virtual destructor.
 
- Public Member Functions inherited from original::printable
 operator std::string () const
 Explicit conversion to std::string.
 
 operator const char * () const
 Explicit conversion to C-style string.
 
const char * toCString (bool enter) const
 Direct C-string access with formatting control.
 
template<typename TYPE >
auto formatString (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatCString (const TYPE &t) -> const char *
 
template<typename TYPE >
auto formatEnum (const TYPE &t) -> std::string
 
template<typename TYPE >
auto formatString (TYPE *const &ptr) -> std::string
 

Static Public Member Functions

static point now ()
 Gets current time point.
 
- Static Public Member Functions inherited from original::printable
template<typename TYPE >
static std::string formatString (const TYPE &t)
 Universal value-to-string conversion.
 
template<Printable TYPE>
static std::string formatString (const TYPE &t)
 Specialization for printable types.
 
template<EnumType TYPE>
static std::string formatString (const TYPE &t)
 Specialization for enum types.
 
template<typename TYPE >
static std::string formatString (TYPE *const &ptr)
 Pointer-specific formatting.
 
template<typename TYPE >
static const char * formatCString (const TYPE &t)
 C-string cache for temporary usage.
 
template<typename TYPE >
static std::string formatEnum (const TYPE &t)
 Enum formatting utility.
 
template<>
auto formatString (const char &t) -> std::string
 
template<>
auto formatString (const bool &t) -> std::string
 
template<>
auto formatString (const char *const &ptr) -> std::string
 

Friends

class UTCTime
 
point operator+ (const point &p, const duration &d)
 Adds duration to time point.
 
point operator+ (const duration &d, const point &p)
 
point operator- (const point &p, const duration &d)
 Subtracts duration from time point.
 
duration operator- (const point &lhs, const point &rhs)
 Computes duration between two time points.
 

Detailed Description

Represents a point in time with nanosecond precision.

Represents time since epoch (1970-01-01 00:00:00 UTC)

Constructor & Destructor Documentation

◆ point() [1/2]

original::time::point::point ( time_val_type val = 0,
unit unit = MILLISECOND )
inlineexplicit

Constructs time point from value and unit.

Parameters
valTime value
unitUnit of time (default: MILLISECOND)

◆ point() [2/2]

original::time::point::point ( duration d)
inlineexplicit

Constructs time point from duration.

Parameters
dDuration since epoch

Member Function Documentation

◆ className()

std::string original::time::point::className ( ) const
inlineoverridevirtual

Gets the class name.

Returns
"time::point"

Reimplemented from original::printable.

◆ compareTo()

original::integer original::time::point::compareTo ( const point & other) const
inlinenodiscardoverride

Compares this time point to another.

Parameters
otherTime point to compare with
Returns
Negative if this < other, 0 if equal, positive if this > other

◆ now()

original::time::point original::time::point::now ( )
inlinestatic

Gets current time point.

Returns
Current time point

◆ operator++() [1/2]

original::time::point & original::time::point::operator++ ( )
inline

Prefix increment (adds 1 nanosecond)

Returns
Reference to modified time point

◆ operator++() [2/2]

original::time::point original::time::point::operator++ ( int postfix)
inline

Postfix increment (adds 1 nanosecond)

Parameters
postfixDummy parameter for postfix
Returns
Copy of time point before increment

◆ operator+=()

original::time::point & original::time::point::operator+= ( const duration & d)
inline

Adds duration to time point.

Parameters
dDuration to add
Returns
Reference to modified time point

◆ operator--() [1/2]

original::time::point & original::time::point::operator-- ( )
inline

Prefix decrement (subtracts 1 nanosecond)

Returns
Reference to modified time point

◆ operator--() [2/2]

original::time::point original::time::point::operator-- ( int postfix)
inline

Postfix decrement (subtracts 1 nanosecond)

Parameters
postfixDummy parameter for postfix
Returns
Copy of time point before decrement

◆ operator-=()

original::time::point & original::time::point::operator-= ( const duration & d)
inline

Subtracts duration from time point.

Parameters
dDuration to subtract
Returns
Reference to modified time point

◆ toHash()

original::u_integer original::time::point::toHash ( ) const
inlineoverridevirtualnoexcept

Computes hash value for this time point.

Returns
Hash value

Reimplemented from original::hashable< point >.

◆ toString()

std::string original::time::point::toString ( bool enter) const
inlineoverridevirtual

Converts time point to string representation.

Parameters
enterWhether to include newline
Returns
String representation

Reimplemented from original::printable.

◆ value()

original::time::time_val_type original::time::point::value ( unit unit = MILLISECOND) const
inlinenodiscardnoexcept

Gets time value in specified units.

Parameters
unitUnit to return value in (default: MILLISECOND)
Returns
Time value in requested units

Friends And Related Symbol Documentation

◆ operator+

point operator+ ( const point & p,
const duration & d )
friend

Adds duration to time point.

Parameters
pTime point
dDuration to add
Returns
New time point after addition

◆ operator- [1/2]

duration operator- ( const point & lhs,
const point & rhs )
friend

Computes duration between two time points.

Parameters
lhsLeft operand
rhsRight operand
Returns
Duration between points

◆ operator- [2/2]

point operator- ( const point & p,
const duration & d )
friend

Subtracts duration from time point.

Parameters
pTime point
dDuration to subtract
Returns
New time point after subtraction

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