|
Time Shield Library
C++ library for working with time
|
Header file with functions for parsing dates and times in ISO8601 format and converting them to various timestamp formats. More...
Go to the source code of this file.
Namespaces | |
| namespace | time_shield |
| Main namespace for the Time Shield library. | |
| namespace | time_shield::detail |
Functions | |
| std::string | time_shield::detail::trim_copy_ascii (const std::string &s) |
| Trim ASCII whitespace from both ends. | |
| std::string_view | time_shield::detail::trim_view_ascii (std::string_view v) |
| Trim ASCII whitespace from both ends (string_view). | |
| void | time_shield::detail::normalise_month_token_lower (const std::string &month, std::string &output) |
| Normalize month token to lower-case ASCII using current locale facet. | |
| void | time_shield::detail::normalise_month_token_lower (std::string_view month, std::string &output) |
| Normalize month token to lower-case ASCII using current locale facet (string_view). | |
| bool | time_shield::detail::try_parse_month_index (const std::string &month, int &value) |
| Try parse month name token into month index (1..12). | |
| bool | time_shield::detail::try_parse_month_index (std::string_view month, int &value) |
| Try parse month name token into month index (1..12), string_view overload. | |
| int | time_shield::detail::parse_month_index (const std::string &month) |
| Parse month name token into month index (1..12). | |
| int | time_shield::detail::parse_month_index (std::string_view month) |
| Parse month name token into month index (1..12), string_view overload. | |
| TIME_SHIELD_CONSTEXPR bool | time_shield::detail::is_ascii_space (char c) noexcept |
| Check whether character is ASCII whitespace. | |
| TIME_SHIELD_CONSTEXPR bool | time_shield::detail::is_ascii_digit (char c) noexcept |
| Check whether character is ASCII digit. | |
| TIME_SHIELD_CONSTEXPR void | time_shield::detail::skip_spaces (const char *&p, const char *end) noexcept |
| Skip ASCII whitespace. | |
| TIME_SHIELD_CONSTEXPR bool | time_shield::detail::parse_2digits (const char *&p, const char *end, int &out) noexcept |
| Parse exactly 2 digits into int. | |
| TIME_SHIELD_CONSTEXPR bool | time_shield::detail::parse_4digits_year (const char *&p, const char *end, year_t &out) noexcept |
| Parse exactly 4 digits into year_t (via int). | |
| TIME_SHIELD_CONSTEXPR bool | time_shield::detail::parse_fraction_to_ms (const char *&p, const char *end, int &ms_out) noexcept |
| Parse fractional seconds (1..9 digits) and convert to milliseconds. | |
| bool | time_shield::try_parse_month (const std::string &month, int &value) |
| Try parse month name token into month index [1..12]. | |
| int | time_shield::parse_month (const std::string &month) |
| Parse month name token into month index [1..12]. | |
| bool | time_shield::try_parse_month (std::string_view month, int &value) |
| Try parse month name token into month index [1..12], string_view overload. | |
| int | time_shield::parse_month (std::string_view month) |
| Parse month name token into month index [1..12], string_view overload. | |
| template<class T = Month> | |
| T | time_shield::parse_month_enum (const std::string &month) |
| Parse month name token into Month enum (throwing). | |
| template<class T = Month> | |
| bool | time_shield::try_parse_month_enum (const std::string &month, T &value) |
| Try parse month name token into Month enum (or any T). | |
| template<class T = Month> | |
| T | time_shield::parse_month_enum (std::string_view month) |
| Parse month name token into Month enum (throwing), string_view overload. | |
| template<class T = Month> | |
| bool | time_shield::try_parse_month_enum (std::string_view month, T &value) |
| Try parse month name token into Month enum (or any T), string_view overload. | |
| bool | time_shield::try_get_month_index (const std::string &month, int &value) |
| Try parse month name token into month index [1..12]. | |
| int | time_shield::get_month_index (const std::string &month) |
| Parse month name token into month index [1..12]. | |
| Month | time_shield::get_month_index_enum (const std::string &month) |
| Parse month name token into Month enum. | |
| bool | time_shield::try_get_month_index (std::string_view month, int &value) |
| Try parse month name token into month index [1..12], string_view overload. | |
| int | time_shield::get_month_index (std::string_view month) |
| Parse month name token into month index [1..12], string_view overload. | |
| Month | time_shield::get_month_index_enum (std::string_view month) |
| Parse month name token into Month enum, string_view overload. | |
| template<class T = Month> | |
| T | time_shield::get_month_number (const std::string &month) |
| Get the month number by name (throwing). | |
| template<class T = Month> | |
| T | time_shield::month_of_year (const std::string &month) |
| Alias for get_month_number (throwing). | |
| template<class T = Month> | |
| bool | time_shield::try_get_month_number (const std::string &month, T &value) |
| Try get the month number by name, with output parameter. | |
| template<class T = Month> | |
| bool | time_shield::get_month_number (const std::string &month, T &value) |
| Alias for try_get_month_number (output parameter). | |
| template<class T = Month> | |
| bool | time_shield::month_of_year (const std::string &month, T &value) |
| Alias for try_get_month_number (output parameter). | |
| template<class T = Month> | |
| T | time_shield::get_month_number (std::string_view month) |
| Get the month number by name (throwing), string_view overload. | |
| template<class T = Month> | |
| T | time_shield::month_of_year (std::string_view month) |
| Alias for get_month_number (throwing), string_view overload. | |
| template<class T = Month> | |
| bool | time_shield::try_get_month_number (std::string_view month, T &value) |
| Try get the month number by name, string_view overload. | |
| template<class T = Month> | |
| bool | time_shield::get_month_number (std::string_view month, T &value) |
| Alias for try_get_month_number, string_view overload. | |
| template<class T = Month> | |
| bool | time_shield::month_of_year (std::string_view month, T &value) |
| Alias for try_get_month_number, string_view overload. | |
| template<class T = Month> | |
| T | time_shield::get_month_number (const char *month) |
| Get the month number by name (throwing), const char* overload. | |
| template<class T = Month> | |
| bool | time_shield::try_get_month_number (const char *month, T &value) |
| Try get the month number by name, const char* overload. | |
| template<class T = Month> | |
| T | time_shield::month_of_year (const char *month) |
| Alias for get_month_number (throwing), const char* overload. | |
| template<class T = Month> | |
| bool | time_shield::get_month_number (const char *month, T &value) |
| Alias for try_get_month_number (output parameter), const char* overload. | |
| template<class T = Month> | |
| bool | time_shield::month_of_year (const char *month, T &value) |
| Alias for try_get_month_number (output parameter), const char* overload. | |
| bool | time_shield::parse_time_zone (const char *data, std::size_t length, TimeZoneStruct &tz) noexcept |
| Parse timezone character buffer into TimeZoneStruct. | |
| bool | time_shield::parse_time_zone (const std::string &tz_str, TimeZoneStruct &tz) noexcept |
| Parse timezone string into TimeZoneStruct. | |
| bool | time_shield::parse_tz (const std::string &tz_str, TimeZoneStruct &tz) noexcept |
| Alias for parse_time_zone. | |
| bool | time_shield::parse_tz (const char *data, std::size_t length, TimeZoneStruct &tz) noexcept |
| Alias for parse_time_zone (buffer overload). | |
| bool | time_shield::parse_iso8601 (const char *input, std::size_t length, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept |
| Parse ISO8601 character buffer into DateTimeStruct and TimeZoneStruct. | |
| bool | time_shield::parse_iso8601 (const std::string &input, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept |
| Parse ISO8601 string into DateTimeStruct and TimeZoneStruct. | |
| bool | time_shield::str_to_ts (const std::string &str, ts_t &ts) |
| Convert an ISO8601 string to a timestamp (ts_t). | |
| bool | time_shield::str_to_ts (const char *data, std::size_t length, ts_t &ts) |
| Parse ISO8601 character buffer and convert to timestamp (seconds). | |
| bool | time_shield::str_to_ts_ms (const std::string &str, ts_ms_t &ts) |
| Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
| bool | time_shield::str_to_ts_ms (const char *data, std::size_t length, ts_ms_t &ts) |
| Convert ISO8601 character buffer to millisecond timestamp (ts_ms_t). | |
| bool | time_shield::str_to_fts (const std::string &str, fts_t &ts) |
| Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
| bool | time_shield::str_to_fts (const char *data, std::size_t length, fts_t &ts) |
| Convert ISO8601 character buffer to floating-point timestamp (fts_t). | |
| bool | time_shield::is_workday (const std::string &str) |
| Parse ISO8601 string and check if it falls on a workday (seconds precision). | |
| bool | time_shield::is_workday_ms (const std::string &str) |
| Parse ISO8601 string and check if it falls on a workday (milliseconds precision). | |
| bool | time_shield::workday (const std::string &str) |
| Alias for is_workday(const std::string&). | |
| bool | time_shield::workday_ms (const std::string &str) |
| Alias for is_workday_ms(const std::string&). | |
| bool | time_shield::is_first_workday_of_month (const std::string &str) |
| Parse ISO8601 string and check if it is the first workday of its month (seconds). | |
| bool | time_shield::is_first_workday_of_month_ms (const std::string &str) |
| Parse an ISO8601 string and check if it is the first workday of its month (millisecond precision). | |
| bool | time_shield::is_last_workday_of_month (const std::string &str) |
| Parse an ISO8601 string and check if it is the last workday of its month (seconds). | |
| bool | time_shield::is_last_workday_of_month_ms (const std::string &str) |
| Parse an ISO8601 string and check if it is the last workday of its month (millisecond). | |
| bool | time_shield::is_within_first_workdays_of_month (const std::string &str, int count) |
| Parse an ISO8601 string and check if it falls within the first N workdays of its month. | |
| bool | time_shield::is_within_first_workdays_of_month_ms (const std::string &str, int count) |
| Parse an ISO8601 string and check if it falls within the first N workdays of its month (millisecond precision). | |
| bool | time_shield::is_within_last_workdays_of_month (const std::string &str, int count) |
| Parse ISO8601 string and check if it is within last N workdays of its month (seconds). | |
| bool | time_shield::is_within_last_workdays_of_month_ms (const std::string &str, int count) |
| Parse ISO8601 string and check if it is within last N workdays of its month (milliseconds). | |
| ts_t | time_shield::ts (const char *str) |
| Convert ISO8601 C-string to timestamp (seconds). | |
| ts_t | time_shield::ts (const char *data, std::size_t length) |
| Convert ISO8601 character buffer to timestamp (seconds). | |
| ts_ms_t | time_shield::ts_ms (const char *str) |
| Convert ISO8601 C-string to timestamp (milliseconds). | |
| ts_ms_t | time_shield::ts_ms (const char *data, std::size_t length) |
| Convert ISO8601 character buffer to timestamp (milliseconds). | |
| fts_t | time_shield::fts (const char *str) |
| Convert ISO8601 C-string to floating timestamp (seconds). | |
| fts_t | time_shield::fts (const char *data, std::size_t length) |
| Convert ISO8601 character buffer to floating timestamp (seconds). | |
| ts_t | time_shield::ts (const std::string &str) |
| Convert an ISO8601 string to a timestamp (ts_t). | |
| ts_ms_t | time_shield::ts_ms (const std::string &str) |
| Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
| fts_t | time_shield::fts (const std::string &str) |
| Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
| template<class T = int> | |
| bool | time_shield::sec_of_day (const std::string &str, T &sec) |
| Parse time of day string to seconds of day. | |
| template<class T = int> | |
| T | time_shield::sec_of_day (const std::string &str) |
| Convert time of day string to seconds of day. | |
Header file with functions for parsing dates and times in ISO8601 format and converting them to various timestamp formats.
This file contains functions for parsing ISO8601 date and time strings, extracting month numbers from month names, and converting parsed date and time information to different timestamp formats.
Provides:
str_to_* functions that return bool. Definition in file time_parser.hpp.