xentara-utils v2.0.4
The Xentara Utility Library
|
std::chrono compatibility More...
Classes | |
class | DecomposedDate |
A date, decomposed into its components. More... | |
class | DecomposedTimePoint |
A time point, decomposed into its components. More... | |
Typedefs | |
using | time32_t = detail::time32_t |
The 32-bit version of std::time_t. | |
using | time64_t = detail::time64_t |
The 64-bit version of std::time_t. | |
using | timespec32 = detail::timespec32 |
The 32-bit version of std::timespec. | |
using | timespec64 = detail::timespec64 |
The 64-bit version of std::timespec. | |
template<typename TimeT > | |
using | timespec = typename detail::TimespecTraits< TimeT >::timespec |
A timespec that uses a certain type as std::time_t. | |
Functions | |
template<typename ToDuration , typename Clock , typename Duration > requires __internal_is_chrono_duration_specialization<ToDuration> | |
auto | convertTimePoint (const std::chrono::time_point< Clock, Duration > &timePoint) -> std::chrono::time_point< Clock, ToDuration > |
Converts one type of time stamp to another. | |
String Sizes | |
constexpr auto | maxDateStringSize () -> std::size_t |
Returns the maximum size needed to hold a date string. | |
constexpr auto | maxTimeStringSize (int secondsPrecision=9) -> std::size_t |
Returns the maximum size needed to hold a time string. | |
constexpr auto | maxDateTimeStringSize (int secondsPrecision=9) -> std::size_t |
Returns the maximum size needed to hold a date and time string. | |
Deprecated Functions | |
constexpr auto | maxDateLength () -> std::size_t |
deprecated Deprecated alias for maxDateStringSize() | |
String Conversion | |
template<tools::CharType Char, typename CharTraits = std::char_traits<Char>> | |
auto | toBasicString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::BasicStaticString< Char, maxDateTimeStringSize(), CharTraits > |
Converts a time point to a string. | |
auto | toString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticString< maxDateTimeStringSize()> |
Converts a time point to a string of type char | |
auto | toWString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticWString< maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t | |
auto | toU8String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU8String< maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t | |
auto | toU16String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU16String< maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t | |
auto | toU32String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU32String< maxDateTimeStringSize()> |
Converts a number to a string of type char32_t | |
template<tools::CharType Char, typename CharTraits = std::char_traits<Char>> | |
auto | toCompactBasicString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::BasicStaticString< Char, maxDateTimeStringSize(), CharTraits > |
Converts a time point to a string without unecessary seconds or fractions of a second. | |
auto | toCompactString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticString< maxDateTimeStringSize()> |
Converts a time point to a string of type char without unecessary seconds or fractions of a second. | |
auto | toCompactWString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticWString< maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t without unecessary seconds or fractions of a second. | |
auto | toCompactU8String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU8String< maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t without unecessary seconds or fractions of a second. | |
auto | toCompactU16String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU16String< maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t without unecessary seconds or fractions of a second. | |
auto | toCompactU32String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU32String< maxDateTimeStringSize()> |
Converts a number to a string of type char32_t without unecessary seconds or fractions of a second. | |
template<tools::CharType Char, typename CharTraits = std::char_traits<Char>> | |
auto | toIsoBasicString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::BasicStaticString< Char, maxDateTimeStringSize(), CharTraits > |
Converts a time point to a string in ISO 8601/RFC 3339 format. | |
auto | toIsoString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticString< maxDateTimeStringSize()> |
Converts a time point to a string of type char in ISO 8601/RFC 3339 format. | |
auto | toIsoWString (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticWString< maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t in ISO 8601/RFC 3339 format. | |
auto | toIsoU8String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU8String< maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t in ISO 8601/RFC 3339 format. | |
auto | toIsoU16String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU16String< maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t in ISO 8601/RFC 3339 format. | |
auto | toIsoU32String (std::chrono::system_clock::time_point timePoint, const std::optional< std::chrono::minutes > &utcOffset=std::nullopt) -> string::StaticU32String< maxDateTimeStringSize()> |
Converts a number to a string of type char32_t in ISO 8601/RFC 3339 format. | |
Conversions to Native Types | |
template<typename Rep , typename Period , typename TimeT = std::time_t> | |
auto | toTimeSpec (const std::chrono::duration< Rep, Period > &duration) -> eh::expected< timespec< TimeT >, std::error_code > |
template<typename Clock , typename Duration , typename TimeT = std::time_t> | |
auto | toTimeSpec (const std::chrono::time_point< Clock, Duration > &timePoint) -> eh::expected< timespec< TimeT >, std::error_code > |
Variables | |
constexpr std::chrono::system_clock::time_point | kReferenceTime |
Standard reference time. | |
std::chrono compatibility
This namespace contains date and time facilities.
using xentara::utils::chrono::time32_t = typedef detail::time32_t |
The 32-bit version of std::time_t.
This type only exists on 32-bit platforms that use glibc, like 32-bit Linux. On these platforms, the size of std::time_t can be selected using the feature macro _TIME_BITS. On such platforms, time32_t is as an alias to the 32-bit version of std::time_t, used when _TIME_BITS is not defined, or when it is defined to be 32.
using xentara::utils::chrono::time64_t = typedef detail::time64_t |
The 64-bit version of std::time_t.
This type only exists on 32-bit platforms that use glibc, like 32-bit Linux. On these platforms, the size of std::time_t can be selected using the feature macro _TIME_BITS. On such platforms, time64_t is as an alias to the 64-bit version of std::time_t, used when _TIME_BITS is is defined to be 64.
using xentara::utils::chrono::timespec = typedef typename detail::TimespecTraits<TimeT>::timespec |
A timespec that uses a certain type as std::time_t.
This type corresponds to the std::timespec structure that uses a specific version of std::time_t.
TimeT | The type used for std::time_t. This must be either std::time_t, or time32_t or time64_t on platforms where these are defined. |
using xentara::utils::chrono::timespec32 = typedef detail::timespec32 |
The 32-bit version of std::timespec.
This type only exists on 32-bit platforms that use glibc, like 32-bit Linux. On these platforms, the size of std::time_t can be selected using the feature macro _TIME_BITS. On such platforms, timespec32 is as an alias to the 32-bit version of std::timespec, used when _TIME_BITS is not defined, or when it is defined to be 32.
using xentara::utils::chrono::timespec64 = typedef detail::timespec64 |
The 64-bit version of std::timespec.
This type only exists on 32-bit platforms that use glibc, like 32-bit Linux. On these platforms, the size of std::time_t can be selected using the feature macro _TIME_BITS. On such platforms, timespec64 is as an alias to the 64-bit version of std::timespec, used when _TIME_BITS is is defined to be 64.
auto xentara::utils::chrono::convertTimePoint | ( | const std::chrono::time_point< Clock, Duration > & | timePoint | ) | -> std::chrono::time_point<Clock, ToDuration> |
Converts one type of time stamp to another.
This function behaves similar to std::chrono::time_point_cast, but with the following differences:
#include <xentara/utils/chrono/convert.hpp>
ToDuration | The duration to convert to. Must be a specialization of std:n this functioation |
timePoint | The time point to convert |
|
constexpr |
deprecated Deprecated alias for maxDateStringSize()
|
constexpr |
Returns the maximum size needed to hold a date string.
This function can be used to preallocate buffers used to format date strings.
#include <xentara/utils/chrono/maxStringSize.hpp>
|
constexpr |
Returns the maximum size needed to hold a date and time string.
This function can be used to preallocate buffers used to format time and date strings.
#include <xentara/utils/chrono/maxStringSize.hpp>
secondsPrecision | The precision for the seconds. If secondsPrecision is negative, then the space needed for a string without seconds is returned. |
|
constexpr |
Returns the maximum size needed to hold a time string.
This function can be used to preallocate buffers used to format time strings.
#include <xentara/utils/chrono/maxStringSize.hpp>
secondsPrecision | The precision for the seconds. If secondsPrecision is negative, then the space needed for a string without seconds is returned. |
auto xentara::utils::chrono::toBasicString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::BasicStaticString<Char, maxDateTimeStringSize(), CharTraits> |
Converts a time point to a string.
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactBasicString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::BasicStaticString<Char, maxDateTimeStringSize(), CharTraits> |
Converts a time point to a string without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticString<maxDateTimeStringSize()> |
Converts a time point to a string of type char without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactU16String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU16String<maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactU32String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU32String<maxDateTimeStringSize()> |
Converts a number to a string of type char32_t without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactU8String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU8String<maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toCompactWString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticWString<maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t without unecessary seconds or fractions of a second.
This function converts the time point into a human readable, region independent string. If the time point does not contain any seconds, then the returned string has the minimal “2001-01-01 01:00 UTC+01:00”. If the time point contains seconds, the seconds are added to the time, with as many decimal digits as necessary.
A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoBasicString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::BasicStaticString<Char, maxDateTimeStringSize(), CharTraits> |
Converts a time point to a string in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticString<maxDateTimeStringSize()> |
Converts a time point to a string of type char in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoU16String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU16String<maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoU32String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU32String<maxDateTimeStringSize()> |
Converts a number to a string of type char32_t in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoU8String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU8String<maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toIsoWString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticWString<maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t in ISO 8601/RFC 3339 format.
The returned string has the format YYYY-MM-DDThh:mm:ss.zzzzzzzzz±HH:MM. For a utcOffset of 0, ±HH:MM is replaced with the character “Z”.
The year value in the output is limited to a range of 0000 to 9999. Time stamps with smaller or greater year valuess are formatted as “0000-01-01T00:00:00.000000000Z” and “9999-12-31T23:59:59.999999999Z”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticString<maxDateTimeStringSize()> |
Converts a time point to a string of type char
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toTimeSpec | ( | const std::chrono::duration< Rep, Period > & | duration | ) | -> eh::expected<timespec<TimeT>, std::error_code> |
auto xentara::utils::chrono::toTimeSpec | ( | const std::chrono::time_point< Clock, Duration > & | timePoint | ) | -> eh::expected<timespec<TimeT>, std::error_code> |
auto xentara::utils::chrono::toU16String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU16String<maxDateTimeStringSize()> |
Converts a time point to a string of type char16_t
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toU32String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU32String<maxDateTimeStringSize()> |
Converts a number to a string of type char32_t
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toU8String | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticU8String<maxDateTimeStringSize()> |
Converts a time point to a string of type char8_t
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
auto xentara::utils::chrono::toWString | ( | std::chrono::system_clock::time_point | timePoint, |
const std::optional< std::chrono::minutes > & | utcOffset = std::nullopt |
||
) | -> string::StaticWString<maxDateTimeStringSize()> |
Converts a time point to a string of type wchar_t
This function converts the time point into a human readable, region independent string. The string has the format “2001-01-01 01:00:00 UTC+01:00”. A special format is used for std::chrono::system_clock::time_point::max() and std::chrono::system_clock::time_point::min(), which are formatted as “never (infinity)” and “never (-infinity)”, respectively.
#include <xentara/utils/chrono/toString.hpp>
timePoint | The time point |
utcOffset | The UTC offset to represent the time in, or std::nullopt to use local time. The UTC offset only influences how the time is represented in the constructed object: timePoint must always be a regular UTC time without any offset. If you pass a time of 1 January 2001, 00:00:00.000 UTC and a UTC offset of +1 hours, the time will decomposed to 2001-01-01 01:00:00 UTC+01:00, for example. |
|
constexpr |
Standard reference time.
This time point can be used as referenece time for calculating phase offsets in function generators and timers. A phase offset of 0 should be aligned such that the wave form or timer is aligned with this time point.
The time point is January 1, 2001, 00:00:00 UTC.
#include <xentara/utils/chrono/Constants.hpp>