CnxTimePoint module
CnxTimePoint represents a specific point in time, since the UNIX epoch, represented in a particular level of precision
Classes
- struct CnxTimePoint
CnxTimePointrepresents a specific point in time, since the UNIX epoch, represented in a particular level of precision
Enums
- enum CnxTimePointLocale { CNX_UTC_TIME = 0, CNX_LOCAL_TIME, CNX_UNKNOWN_TIME }
- Indicates whether a
CnxTimePointis in UTC time, local time, or an unknown locale.
Typedefs
- using CnxTimePointLocale = enum CnxTimePointLocale
- Indicates whether a
CnxTimePointis in UTC time, local time, or an unknown locale. - using CnxTimePoint = struct CnxTimePoint
CnxTimePointrepresents a specific point in time, since the UNIX epoch, represented in a particular level of precision
Functions
- CnxTimePoint cnx_time_point_new(CnxDuration time_since_epoch)
- Constructs a new
CnxTimePointrepresenting the given time since the UNIX epoch, assuming the same precision ascnx_system_clock - CnxTimePoint cnx_time_point_new_with_clock(CnxDuration time_since_epoch, const CnxClock*restrict clock) cnx_disable_if(!clock
- Constructs a new
CnxTimePointrepresenting the given time since the UNIX epoch, with the same precision of the givenCnxClock - CnxTimePoint cnx_time_point_new_with_clock_and_locale(CnxDuration time_since_epoch, const CnxClock*restrict clock, CnxTimePointLocale locale) cnx_disable_if(!clock
- Constructs a new
CnxTimePointrepresenting the given time since the UNIX epoch, with the same precision of the givenCnxClock - CnxDuration cnx_time_point_time_since_epoch(CnxTimePoint self)
- Returns the time since the UNIX epoch of the given
CnxTimePoint - CnxTimePoint cnx_time_point_min(CnxTimePoint self)
- Returns the minimum possible
CnxTimePointwith the same precision as the given one. - CnxTimePoint cnx_time_point_max(CnxTimePoint self)
- Returns the maximum possible
CnxTimePointwith the same precision as the given one. - CnxTimePoint cnx_time_point_cast(CnxTimePoint to_cast, CnxTimePoint new_precision)
- Converts the first
CnxTimePointto the same precision as the second one. - CnxTimePoint cnx_time_point_ceil(CnxTimePoint to_cast, CnxTimePoint new_precision)
- Converts the first
CnxTimePointto the same precision as the second one, taking the ceiling of any fractional part in the result. - CnxTimePoint cnx_time_point_floor(CnxTimePoint to_cast, CnxTimePoint new_precision)
- Converts the first
CnxTimePointto the same precision as the second one, taking the floor of any fractional part in the result. - CnxTimePoint cnx_time_point_round(CnxTimePoint to_cast, CnxTimePoint new_precision)
- Converts the first
CnxTimePointto the same precision as the second one, rounding any fractional part in the result. - time_t cnx_time_point_as_time_t(CnxTimePoint to_cast)
- Converts the given
CnxTimePointtotime_t - CnxResult(tm)
- Converts the given
CnxTimePointtotm - CnxTimePoint cnx_time_point_from_time_t(time_t time)
- Converts the given
time_tto aCnxTimePointin the system clock precision. - void cnx_time_point_increment(CnxTimePoint*restrict self)
- Increments the given
CnxTimePointby one unit. - void cnx_time_point_decrement(CnxTimePoint*restrict self)
- Decrements the given
CnxTimePointby one unit. - CnxTimePoint cnx_time_point_add(CnxTimePoint lhs, CnxDuration rhs)
- Adds the given
CnxDurationto the givenCnxTimePoint - CnxTimePoint cnx_time_point_subtract(CnxTimePoint lhs, CnxDuration rhs)
- Subtracts the given
CnxDurationfrom the givenCnxTimePoint - CnxTimePoint cnx_time_point_add_time_point(CnxTimePoint lhs, CnxTimePoint rhs)
- Adds the rhs
CnxTimePointto the lhsCnxTimePoint - CnxTimePoint cnx_time_point_subtract_time_point(CnxTimePoint lhs, CnxTimePoint rhs)
- Subtracts the rhs
CnxDurationfrom the lhsCnxTimePoint - CnxTimePoint cnx_time_point_add_scalar(CnxTimePoint lhs, i64 rhs)
- Adds the given scalar value to the given
CnxTimePointas if it were aCnxTimePointorCnxDurationin the same precision. - CnxTimePoint cnx_time_point_subtract_scalar(CnxTimePoint lhs, i64 rhs)
- Subtracts the given scalar value from the given
CnxTimePointas if it were aCnxTimePointorCnxDurationin the same precision. - bool cnx_time_point_equal(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the two
CnxTimePoints are equivalent. Converts to the precision of the most precise of the two prior to comparison. - bool cnx_time_point_not_equal(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the two
CnxTimePoints are NOT equivalent. Converts to the precision of the most precise of the two prior to comparison. - bool cnx_time_point_less_than(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the left-hand-side
CnxTimePointis less than the right-hand-side Converts to the precision of the most precise of the two prior to comparison. - bool cnx_time_point_less_than_or_equal(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the left-hand-side
CnxTimePointis less than or equal to the right-hand-side. Converts to the precision of the most precise of the two prior to comparison. - bool cnx_time_point_greater_than(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the left-hand-side
CnxTimePointis greater than the right-hand-side Converts to the precision of the most precise of the two prior to comparison. - bool cnx_time_point_greater_than_or_equal(CnxTimePoint lhs, CnxTimePoint rhs)
- Determines if the left-hand-side
CnxTimePointis greater than or equal to the right-hand-side. Converts to the precision of the most precise of the two prior to comparison. - CnxCompare cnx_time_point_compare(CnxTimePoint lhs, CnxTimePoint rhs)
- Performs a three-way comparison of
lhstorhs, determining howlhsmathematically relates torhs. Converts to the precision of the most precise of the two prior to comparison. - CnxString cnx_time_point_format(const CnxFormat*restrict self, CnxFormatContext context)
- Implements the allocator-unaware part of the
CnxFormattrait forCnxTimePoint - CnxString cnx_time_point_format_with_allocator(const CnxFormat*restrict self, CnxFormatContext context, CnxAllocator allocator)
- Implements the allocator-aware part of the
CnxFormattrait forCnxTimePoint -
static ImplTraitFor(CnxFormat,
CnxTimePoint,
cnx_
time_ point_ is_ specifier_ valid, cnx_ time_ point_ format, cnx_ time_ point_ format_ with_ allocator) - Implements the
CnxFormattrait forCnxTimePoint
Variables
- CnxDuration time_since_epoch
- The point in time, represented as a duration since the UNIX epoch.
- const CnxClock* clock
- The clock associated with this time point.
Enum documentation
enum CnxTimePointLocale
#include <include/Cnx/time/TimePoint.h>
Indicates whether a CnxTimePoint is in UTC time, local time, or an unknown locale.
Typedef documentation
typedef enum CnxTimePointLocale CnxTimePointLocale
#include <include/Cnx/time/TimePoint.h>
Indicates whether a CnxTimePoint is in UTC time, local time, or an unknown locale.
typedef struct CnxTimePoint CnxTimePoint
#include <include/Cnx/time/TimePoint.h>
CnxTimePoint represents a specific point in time, since the UNIX epoch, represented in a particular level of precision
Function documentation
CnxTimePoint cnx_time_point_new(CnxDuration time_since_epoch)
#include <include/Cnx/time/TimePoint.h>
Constructs a new CnxTimePoint representing the given time since the UNIX epoch, assuming the same precision as cnx_system_clock
| Parameters | |
|---|---|
| time_since_epoch | - The time since the UNIX epoch. The precision of the CnxTimePoint will be the period of this CnxDuration |
| Returns | a CnxTimePoint representing the given time since the epoch |
CnxTimePoint cnx_time_point_new_with_clock(CnxDuration time_since_epoch,
const CnxClock*restrict clock) cnx_disable_if(!clock
#include <include/Cnx/time/TimePoint.h>
Constructs a new CnxTimePoint representing the given time since the UNIX epoch, with the same precision of the given CnxClock
| Parameters | |
|---|---|
| time_since_epoch | - The time since the UNIX epoch. The precision of the CnxTimePoint will be the period of this CnxDuration |
| clock | - The clock associated with this time point |
| Returns | a CnxTimePoint representing the given time since the epoch |
CnxTimePoint cnx_time_point_new_with_clock_and_locale(CnxDuration time_since_epoch,
const CnxClock*restrict clock,
CnxTimePointLocale locale) cnx_disable_if(!clock
#include <include/Cnx/time/TimePoint.h>
Constructs a new CnxTimePoint representing the given time since the UNIX epoch, with the same precision of the given CnxClock
| Parameters | |
|---|---|
| time_since_epoch | - The time since the UNIX epoch. The precision of the CnxTimePoint will be the period of this CnxDuration |
| clock | - The clock associated with this time point |
| locale | - Whether this time point is in UTC time, local time, or some unknown time locale |
| Returns | a CnxTimePoint representing the given time since the epoch |
CnxDuration cnx_time_point_time_since_epoch(CnxTimePoint self)
#include <include/Cnx/time/TimePoint.h>
Returns the time since the UNIX epoch of the given CnxTimePoint
| Parameters | |
|---|---|
| self | - The CnxTimePoint to get the represented time from |
| Returns | The time since the epoch represented by self, as a CnxDuration |
CnxTimePoint cnx_time_point_min(CnxTimePoint self)
#include <include/Cnx/time/TimePoint.h>
Returns the minimum possible CnxTimePoint with the same precision as the given one.
| Parameters | |
|---|---|
| self | - The CnxTimePoint with the desired precision |
| Returns | The minimum possible CnxTimePoint with the same precision as the given one |
CnxTimePoint cnx_time_point_max(CnxTimePoint self)
#include <include/Cnx/time/TimePoint.h>
Returns the maximum possible CnxTimePoint with the same precision as the given one.
| Parameters | |
|---|---|
| self | - The CnxTimePoint with the desired precision |
| Returns | The maximum possible CnxTimePoint with the same precision as the given one |
CnxTimePoint cnx_time_point_cast(CnxTimePoint to_cast,
CnxTimePoint new_precision)
#include <include/Cnx/time/TimePoint.h>
Converts the first CnxTimePoint to the same precision as the second one.
| Parameters | |
|---|---|
| to_cast | - The CnxTimePoint to convert the precision of |
| new_precision | - The CnxTimePoint with the precision to convert to |
| Returns | to_cast converted to the precision of new_precision |
CnxTimePoint cnx_time_point_ceil(CnxTimePoint to_cast,
CnxTimePoint new_precision)
#include <include/Cnx/time/TimePoint.h>
Converts the first CnxTimePoint to the same precision as the second one, taking the ceiling of any fractional part in the result.
| Parameters | |
|---|---|
| to_cast | - The CnxTimePoint to convert the precision of |
| new_precision | - The CnxTimePoint with the precision to convert to |
| Returns | to_cast converted to the precision of new_precision |
CnxTimePoint cnx_time_point_floor(CnxTimePoint to_cast,
CnxTimePoint new_precision)
#include <include/Cnx/time/TimePoint.h>
Converts the first CnxTimePoint to the same precision as the second one, taking the floor of any fractional part in the result.
| Parameters | |
|---|---|
| to_cast | - The CnxTimePoint to convert the precision of |
| new_precision | - The CnxTimePoint with the precision to convert to |
| Returns | to_cast converted to the precision of new_precision |
CnxTimePoint cnx_time_point_round(CnxTimePoint to_cast,
CnxTimePoint new_precision)
#include <include/Cnx/time/TimePoint.h>
Converts the first CnxTimePoint to the same precision as the second one, rounding any fractional part in the result.
| Parameters | |
|---|---|
| to_cast | - The CnxTimePoint to convert the precision of |
| new_precision | - The CnxTimePoint with the precision to convert to |
| Returns | to_cast converted to the precision of new_precision |
time_t cnx_time_point_as_time_t(CnxTimePoint to_cast)
#include <include/Cnx/time/TimePoint.h>
Converts the given CnxTimePoint to time_t
| Parameters | |
|---|---|
| to_cast | - The CnxTimePoint to convert |
| Returns | to_cast converted to time_t |
CnxResult(tm)
#include <include/Cnx/time/TimePoint.h>
Converts the given CnxTimePoint to tm
| Returns | to_cast converted to tm |
|---|
CnxTimePoint cnx_time_point_from_time_t(time_t time)
#include <include/Cnx/time/TimePoint.h>
Converts the given time_t to a CnxTimePoint in the system clock precision.
| Parameters | |
|---|---|
| time | - The time_t to convert |
| Returns | time converted to a CnxTimePoint |
void cnx_time_point_increment(CnxTimePoint*restrict self)
#include <include/Cnx/time/TimePoint.h>
Increments the given CnxTimePoint by one unit.
| Parameters | |
|---|---|
| self | - The CnxTimePoint to increment |
void cnx_time_point_decrement(CnxTimePoint*restrict self)
#include <include/Cnx/time/TimePoint.h>
Decrements the given CnxTimePoint by one unit.
| Parameters | |
|---|---|
| self | - The CnxTimePoint to decrement |
CnxTimePoint cnx_time_point_add(CnxTimePoint lhs,
CnxDuration rhs)
#include <include/Cnx/time/TimePoint.h>
Adds the given CnxDuration to the given CnxTimePoint
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to add to |
| rhs | - The amount of time to add to lhs |
| Returns | the result of the addition |
CnxTimePoint cnx_time_point_subtract(CnxTimePoint lhs,
CnxDuration rhs)
#include <include/Cnx/time/TimePoint.h>
Subtracts the given CnxDuration from the given CnxTimePoint
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to subtract from |
| rhs | - The amount of time to subtract from lhs |
| Returns | the result of the subtraction |
CnxTimePoint cnx_time_point_add_time_point(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Adds the rhs CnxTimePoint to the lhs CnxTimePoint
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to add to |
| rhs | - The amount of time to add to lhs |
| Returns | the result of the addition |
CnxTimePoint cnx_time_point_subtract_time_point(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Subtracts the rhs CnxDuration from the lhs CnxTimePoint
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to subtract from |
| rhs | - The amount of time to subtract from lhs |
| Returns | the result of the subtraction |
CnxTimePoint cnx_time_point_add_scalar(CnxTimePoint lhs,
i64 rhs)
#include <include/Cnx/time/TimePoint.h>
Adds the given scalar value to the given CnxTimePoint as if it were a CnxTimePoint or CnxDuration in the same precision.
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to add to |
| rhs | - The amount of time to add to lhs |
| Returns | the result of the addition |
CnxTimePoint cnx_time_point_subtract_scalar(CnxTimePoint lhs,
i64 rhs)
#include <include/Cnx/time/TimePoint.h>
Subtracts the given scalar value from the given CnxTimePoint as if it were a CnxTimePoint or CnxDuration in the same precision.
| Parameters | |
|---|---|
| lhs | - The CnxTimePoint to add to |
| rhs | - The amount of time to add to lhs |
| Returns | the result of the addition |
bool cnx_time_point_equal(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the two CnxTimePoints are equivalent. Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether the two CnxTimePoints are equivalent |
bool cnx_time_point_not_equal(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the two CnxTimePoints are NOT equivalent. Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether the two CnxTimePoints are NOT equivalent |
bool cnx_time_point_less_than(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the left-hand-side CnxTimePoint is less than the right-hand-side Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether lhs < rhs |
bool cnx_time_point_less_than_or_equal(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the left-hand-side CnxTimePoint is less than or equal to the right-hand-side. Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether lhs <= rhs |
bool cnx_time_point_greater_than(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the left-hand-side CnxTimePoint is greater than the right-hand-side Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether lhs > rhs |
bool cnx_time_point_greater_than_or_equal(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Determines if the left-hand-side CnxTimePoint is greater than or equal to the right-hand-side. Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | Whether lhs >= rhs |
CnxCompare cnx_time_point_compare(CnxTimePoint lhs,
CnxTimePoint rhs)
#include <include/Cnx/time/TimePoint.h>
Performs a three-way comparison of lhs to rhs, determining how lhs mathematically relates to rhs. Converts to the precision of the most precise of the two prior to comparison.
| Parameters | |
|---|---|
| lhs | - The left-hand-side CnxTimePoint to compare |
| rhs | - The right-hand-side CnxTimePoint to compare |
| Returns | How lhs compares to rhs, as CnxCompare |
CnxString cnx_time_point_format(const CnxFormat*restrict self,
CnxFormatContext context)
#include <include/Cnx/time/TimePoint.h>
Implements the allocator-unaware part of the CnxFormat trait for CnxTimePoint
| Parameters | |
|---|---|
| self | - The CnxTimePoint to format, as its CnxFormat trait representation |
| context | - The CnxFormatContext specifying how formatting should be done |
| Returns | self formatted as a CnxString |
CnxString cnx_time_point_format_with_allocator(const CnxFormat*restrict self,
CnxFormatContext context,
CnxAllocator allocator)
#include <include/Cnx/time/TimePoint.h>
Implements the allocator-aware part of the CnxFormat trait for CnxTimePoint
| Parameters | |
|---|---|
| self | - The CnxTimePoint to format, as its CnxFormat trait representation |
| context | - The CnxFormatContext specifying how formatting should be done |
| allocator | - The CnxAllocator to allocate memory with |
| Returns | self formatted as a CnxString |
static ImplTraitFor(CnxFormat,
CnxTimePoint,
cnx_ time_ point_ is_ specifier_ valid,
cnx_ time_ point_ format,
cnx_ time_ point_ format_ with_ allocator)
#include <include/Cnx/time/TimePoint.h>
Implements the CnxFormat trait for CnxTimePoint
Variable documentation
CnxDuration time_since_epoch
#include <include/Cnx/time/TimePoint.h>
The point in time, represented as a duration since the UNIX epoch.
const CnxClock* clock
#include <include/Cnx/time/TimePoint.h>
The clock associated with this time point.