ORIGINAL
|
Represents a point in time with nanosecond precision. More...
#include <zeit.h>
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. | |
point & | operator++ () |
Prefix increment (adds 1 nanosecond) | |
point | operator++ (int postfix) |
Postfix increment (adds 1 nanosecond) | |
point & | operator-- () |
Prefix decrement (subtracts 1 nanosecond) | |
point | operator-- (int postfix) |
Postfix decrement (subtracts 1 nanosecond) | |
point & | operator+= (const duration &d) |
Adds duration to time point. | |
point & | operator-= (const duration &d) |
Subtracts duration from time 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. | |
![]() | |
virtual bool | equals (const point &other) const noexcept |
Compares two objects for equality. | |
virtual | ~hashable ()=0 |
Virtual destructor. | |
![]() | |
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. | |
![]() | |
template<typename TYPE > | |
static std::string | formatString (const TYPE &t) |
Universal value-to-string conversion with type-specific formatting. | |
template<Printable TYPE> | |
static std::string | formatString (const TYPE &t) |
Specialization for types deriving from printable. | |
template<EnumType TYPE> | |
static std::string | formatString (const TYPE &t) |
Specialization for enum types with type-safe formatting. | |
template<typename TYPE > | |
static std::string | formatString (TYPE *const &ptr) |
Pointer-specific formatting with null safety. | |
template<typename TYPE > | |
static const char * | formatCString (const TYPE &t) |
C-string cache for temporary usage with static storage. | |
template<typename TYPE > | |
static std::string | formatEnum (const TYPE &t) |
Enum formatting utility with underlying value extraction. | |
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. | |
Represents a point in time with nanosecond precision.
Represents time since epoch (1970-01-01 00:00:00 UTC)
|
inlineexplicit |
Constructs time point from value and unit.
val | Time value |
unit | Unit of time (default: MILLISECOND) |
|
inlineexplicit |
Constructs time point from duration.
d | Duration since epoch |
|
inlineoverridevirtual |
|
inlineoverride |
Compares this time point to another.
other | Time point to compare with |
|
inlinestatic |
Gets current time point.
|
inline |
Prefix increment (adds 1 nanosecond)
|
inline |
Postfix increment (adds 1 nanosecond)
postfix | Dummy parameter for postfix |
|
inline |
Adds duration to time point.
d | Duration to add |
|
inline |
Prefix decrement (subtracts 1 nanosecond)
|
inline |
Postfix decrement (subtracts 1 nanosecond)
postfix | Dummy parameter for postfix |
|
inline |
Subtracts duration from time point.
d | Duration to subtract |
|
inlineoverridevirtualnoexcept |
Computes hash value for this time point.
Reimplemented from original::hashable< point >.
|
inlineoverridevirtual |
Converts time point to string representation.
enter | Whether to include newline |
Reimplemented from original::printable.
|
inlinenoexcept |
Gets time value in specified units.
unit | Unit to return value in (default: MILLISECOND) |
Adds duration to time point.
p | Time point |
d | Duration to add |
Computes duration between two time points.
lhs | Left operand |
rhs | Right operand |
Subtracts duration from time point.
p | Time point |
d | Duration to subtract |