Time Shield Library
C++ library for working with time
|
A comprehensive set of functions for parsing and converting date and time strings. More...
Functions | |
template<class T = Month> | |
T | time_shield::get_month_number (const std::string &month) |
Get the month number by name. | |
template<class T = Month> | |
T | time_shield::month_of_year (const std::string &month) |
Alias for get_month_number function. | |
template<class T = Month> | |
bool | time_shield::try_get_month_number (const std::string &month, T &value) |
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 function. | |
template<class T = Month> | |
bool | time_shield::month_of_year (const std::string &month, T &value) |
Alias for try_get_month_number function. | |
bool | time_shield::parse_time_zone (const std::string &tz_str, TimeZoneStruct &tz) |
Parse a time zone string into a TimeZoneStruct. | |
bool | time_shield::parse_tz (const std::string &tz_str, TimeZoneStruct &tz) |
Alias for parse_time_zone function. | |
bool | time_shield::parse_iso8601 (const std::string &input, DateTimeStruct &dt, TimeZoneStruct &tz) |
Parse a date and time string in ISO8601 format. | |
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_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_fts (const std::string &str, fts_t &ts) |
Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
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. | |
ts_t | time_shield::ts (const char *str) |
Convert an ISO8601 C-style string to a timestamp (ts_t). | |
ts_ms_t | time_shield::ts_ms (const char *str) |
Convert an ISO8601 C-style string to a millisecond timestamp (ts_ms_t). | |
fts_t | time_shield::fts (const char *str) |
Convert an ISO8601 C-style string to a floating-point timestamp (fts_t). | |
int | time_shield::get_month_number (string month) |
Get the month number by name. | |
int | time_shield::month_of_year (string month) |
Alias for get_month_number function. | |
bool | time_shield::try_get_month_number (string month, int &value) |
Get the month number by name, with output parameter. | |
bool | time_shield::get_month_number (string month, int &value) |
Alias for try_get_month_number function. | |
bool | time_shield::month_of_year (string month, int &value) |
Alias for try_get_month_number function. | |
bool | time_shield::parse_time_zone (string tz_str, TimeZoneStruct &tz) |
Parse a time zone string into a TimeZoneStruct. | |
bool | time_shield::parse_tz (string tz_str, TimeZoneStruct &tz) |
Alias for parse_time_zone function. | |
bool | time_shield::parse_iso8601 (string input_str, DateTimeStruct &dt, TimeZoneStruct &tz) |
Parse a date and time string in ISO8601 format. | |
bool | time_shield::str_to_ts (string str, long &ts) |
Convert an ISO8601 string to a timestamp (ts_t). | |
bool | time_shield::str_to_ts_ms (string str, long &ts) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
bool | time_shield::str_to_fts (string str, double &ts) |
Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
long | time_shield::ts (string str) |
Convert an ISO8601 string to a timestamp (ts_t). | |
long | time_shield::ts_ms (string str) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
double | time_shield::fts (string str) |
Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
int | time_shield::sec_of_day (string str) |
Convert string with time of day to second of day. | |
A comprehensive set of functions for parsing and converting date and time strings.
This module provides utilities for parsing date and time strings in ISO8601 format, extracting date components, and converting them into various timestamp formats.
|
inline |
Convert an ISO8601 C-style string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp. If the parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 407 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp. If the parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 303 of file time_parser.hpp.
double time_shield::fts | ( | string | str | ) |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
Returns 0.0 if parsing fails.
str | The ISO8601 string. |
Definition at line 232 of file time_parser.mqh.
T time_shield::get_month_number | ( | const std::string & | month | ) |
Get the month number by name.
T | The return type, default is Month enum. |
month | The name of the month as a string. |
std::invalid_argument | if the month name is invalid. |
Definition at line 64 of file time_parser.hpp.
bool time_shield::get_month_number | ( | const std::string & | month, |
T & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 135 of file time_parser.hpp.
int time_shield::get_month_number | ( | string | month | ) |
Get the month number by name.
month | The name of the month as a string. |
Definition at line 39 of file time_parser.mqh.
bool time_shield::get_month_number | ( | string | month, |
int & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 80 of file time_parser.mqh.
T time_shield::month_of_year | ( | const std::string & | month | ) |
Alias for get_month_number function.
Get the month number by name.
T | The return type, default is Month enum. |
month | The name of the month as a string. |
std::invalid_argument | if the month name is invalid. |
Definition at line 93 of file time_parser.hpp.
bool time_shield::month_of_year | ( | const std::string & | month, |
T & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 142 of file time_parser.hpp.
int time_shield::month_of_year | ( | string | month | ) |
Alias for get_month_number function.
Get the month number by name.
T | The return type, default is Month enum. |
month | The name of the month as a string. |
std::invalid_argument | if the month name is invalid. |
Definition at line 62 of file time_parser.mqh.
bool time_shield::month_of_year | ( | string | month, |
int & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 84 of file time_parser.mqh.
bool time_shield::parse_iso8601 | ( | const std::string & | input, |
DateTimeStruct & | dt, | ||
TimeZoneStruct & | tz ) |
Parse a date and time string in ISO8601 format.
This function parses a date and time string in the ISO8601 format and fills the provided DateTimeStruct and TimeZoneStruct with the parsed values.
input | The input string in ISO8601 format. |
dt | The DateTimeStruct to be filled with the parsed date and time values. |
tz | The TimeZoneStruct to be filled with the parsed time zone values. |
Definition at line 188 of file time_parser.hpp.
bool time_shield::parse_iso8601 | ( | string | input_str, |
DateTimeStruct & | dt, | ||
TimeZoneStruct & | tz ) |
Parse a date and time string in ISO8601 format.
input_str | The input string in ISO8601 format. |
dt | The DateTimeStruct to be filled with parsed values. |
tz | The TimeZoneStruct to be filled with parsed time zone. |
Definition at line 117 of file time_parser.mqh.
bool time_shield::parse_time_zone | ( | const std::string & | tz_str, |
TimeZoneStruct & | tz ) |
Parse a time zone string into a TimeZoneStruct.
This function parses a time zone string in the format "+hh:mm" or "Z" into a TimeZoneStruct. If the string is empty or "Z", it sets the time zone to UTC.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 154 of file time_parser.hpp.
bool time_shield::parse_time_zone | ( | string | tz_str, |
TimeZoneStruct & | tz ) |
Parse a time zone string into a TimeZoneStruct.
Parses a time zone string in the format "+hh:mm", "-hh:mm" or "Z". If the string is empty or "Z", UTC is assumed.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 94 of file time_parser.mqh.
|
inline |
Alias for parse_time_zone function.
Parse a time zone string into a TimeZoneStruct.
This function parses a time zone string in the format "+hh:mm" or "Z" into a TimeZoneStruct. If the string is empty or "Z", it sets the time zone to UTC.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 175 of file time_parser.hpp.
bool time_shield::parse_tz | ( | string | tz_str, |
TimeZoneStruct & | tz ) |
Alias for parse_time_zone function.
Parse a time zone string into a TimeZoneStruct.
This function parses a time zone string in the format "+hh:mm" or "Z" into a TimeZoneStruct. If the string is empty or "Z", it sets the time zone to UTC.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 108 of file time_parser.mqh.
|
inline |
Convert time of day string to seconds of day.
Supported formats:
T | Return type (default int). |
str | Time of day as string. |
Definition at line 372 of file time_parser.hpp.
|
inline |
Parse time of day string to seconds of day.
Supported formats:
T | Return type (default int). |
str | Time of day as string. |
sec | Parsed seconds of day on success. |
Definition at line 323 of file time_parser.hpp.
int time_shield::sec_of_day | ( | string | str | ) |
Convert string with time of day to second of day.
Supports formats:
str | Time in string format |
Definition at line 248 of file time_parser.mqh.
|
inline |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp.
str | The ISO8601 string. |
ts | The floating-point timestamp to be filled. |
Definition at line 265 of file time_parser.hpp.
bool time_shield::str_to_fts | ( | string | str, |
double & | ts ) |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
str | The ISO8601 string. |
ts | The floating-point timestamp to be filled. |
Definition at line 201 of file time_parser.mqh.
|
inline |
Convert an ISO8601 string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp.
str | The ISO8601 string. |
ts | The timestamp to be filled. |
Definition at line 233 of file time_parser.hpp.
bool time_shield::str_to_ts | ( | string | str, |
long & | ts ) |
Convert an ISO8601 string to a timestamp (ts_t).
str | The ISO8601 string. |
ts | The timestamp to be filled. |
Definition at line 179 of file time_parser.mqh.
|
inline |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp.
str | The ISO8601 string. |
ts | The millisecond timestamp to be filled. |
Definition at line 249 of file time_parser.hpp.
bool time_shield::str_to_ts_ms | ( | string | str, |
long & | ts ) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
str | The ISO8601 string. |
ts | The millisecond timestamp to be filled. |
Definition at line 190 of file time_parser.mqh.
bool time_shield::try_get_month_number | ( | const std::string & | month, |
T & | value ) |
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 105 of file time_parser.hpp.
bool time_shield::try_get_month_number | ( | string | month, |
int & | value ) |
Get the month number by name, with output parameter.
month | The name of the month as a string. |
value | Reference to store the month number if found. |
Definition at line 70 of file time_parser.mqh.
|
inline |
Convert an ISO8601 C-style string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp. If parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 385 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp. If parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 281 of file time_parser.hpp.
long time_shield::ts | ( | string | str | ) |
Convert an ISO8601 string to a timestamp (ts_t).
Returns 0 if parsing fails.
str | The ISO8601 string. |
Definition at line 212 of file time_parser.mqh.
|
inline |
Convert an ISO8601 C-style string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp. If parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 396 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp. If parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 292 of file time_parser.hpp.
long time_shield::ts_ms | ( | string | str | ) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
Returns 0 if parsing fails.
str | The ISO8601 string. |
Definition at line 222 of file time_parser.mqh.