Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
Time Parsing

A comprehensive set of functions for parsing and converting date and time strings. More...

Namespaces

namespace  time_shield::detail

Functions

bool time_shield::try_parse_format (const char *data, std::size_t length, const char *format, std::size_t format_length, DateTimeStruct &out_dt, TimeZoneStruct &out_tz) noexcept
 Parse input using formatter-compatible custom pattern.
bool time_shield::try_parse_format_ts (const char *data, std::size_t length, const char *format, std::size_t format_length, ts_t &out_ts) noexcept
 Parse input using formatter-compatible custom pattern and convert to UTC seconds.
bool time_shield::try_parse_format_ts_ms (const char *data, std::size_t length, const char *format, std::size_t format_length, ts_ms_t &out_ts) noexcept
 Parse input using formatter-compatible custom pattern and convert to UTC milliseconds.
bool time_shield::try_parse_format (const std::string &data, const std::string &format, DateTimeStruct &out_dt, TimeZoneStruct &out_tz) noexcept
 Parse std::string using formatter-compatible custom pattern.
bool time_shield::try_parse_format (const char *data, const char *format, DateTimeStruct &out_dt, TimeZoneStruct &out_tz) noexcept
 Parse null-terminated strings using formatter-compatible custom pattern.
bool time_shield::try_parse_format_ts (const std::string &data, const std::string &format, ts_t &out_ts) noexcept
 Parse std::string using formatter-compatible custom pattern and convert to UTC seconds.
bool time_shield::try_parse_format_ts (const char *data, const char *format, ts_t &out_ts) noexcept
 Parse null-terminated strings using custom format and convert to UTC seconds.
bool time_shield::try_parse_format_ts_ms (const std::string &data, const std::string &format, ts_ms_t &out_ts) noexcept
 Parse std::string using formatter-compatible custom pattern and convert to UTC milliseconds.
bool time_shield::try_parse_format_ts_ms (const char *data, const char *format, ts_ms_t &out_ts) noexcept
 Parse null-terminated strings using custom format and convert to UTC milliseconds.
bool time_shield::try_parse_format (std::string_view data, std::string_view format, DateTimeStruct &out_dt, TimeZoneStruct &out_tz) noexcept
 Parse std::string_view using formatter-compatible custom pattern.
bool time_shield::try_parse_format_ts (std::string_view data, std::string_view format, ts_t &out_ts) noexcept
 Parse std::string_view using formatter-compatible custom pattern and convert to UTC seconds.
bool time_shield::try_parse_format_ts_ms (std::string_view data, std::string_view format, ts_ms_t &out_ts) noexcept
 Parse std::string_view using formatter-compatible custom pattern and convert to UTC 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>
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>
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>
time_shield::get_month_number (const std::string &month)
 Get the month number by name (throwing).
template<class T = Month>
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>
time_shield::get_month_number (std::string_view month)
 Get the month number by name (throwing), string_view overload.
template<class T = Month>
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>
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>
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_time_zone_name (const char *data, std::size_t length, TimeZone &zone) noexcept
 Parse named time zone character buffer into TimeZone enum.
bool time_shield::parse_time_zone_name (const std::string &value, TimeZone &zone) noexcept
 Parse named time zone string into TimeZone enum.
bool time_shield::parse_time_zone_name (std::string_view value, TimeZone &zone) noexcept
 Parse named time zone string_view into TimeZone enum.
bool time_shield::parse_time_zone_name (const char *value, TimeZone &zone) noexcept
 Parse named time zone C-string into TimeZone enum.
bool time_shield::parse_tz_name (const char *data, std::size_t length, TimeZone &zone) noexcept
 Alias for parse_time_zone_name.
bool time_shield::parse_tz_name (const std::string &value, TimeZone &zone) noexcept
 Alias for parse_time_zone_name.
bool time_shield::parse_tz_name (std::string_view value, TimeZone &zone) noexcept
 Alias for parse_time_zone_name.
bool time_shield::parse_tz_name (const char *value, TimeZone &zone) noexcept
 Alias for parse_time_zone_name.
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::parse_iso8601 (const char *input, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept
 Parse ISO8601 C-string into DateTimeStruct and TimeZoneStruct.
bool time_shield::parse_iso8601 (std::string_view input, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept
 Parse ISO8601 view 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).
bool time_shield::str_to_timeframe_sec (const std::string &str, ts_t &seconds) noexcept
 Parse timeframe string into fixed seconds.
bool time_shield::str_to_timeframe_sec (const char *str, ts_t &seconds) noexcept
 Parse timeframe C-string into fixed seconds.
bool time_shield::str_to_timeframe_sec (std::string_view str, ts_t &seconds) noexcept
 Parse timeframe view into fixed seconds.
bool time_shield::str_to_timeframe_ms (const std::string &str, ts_ms_t &milliseconds) noexcept
 Parse timeframe string into fixed milliseconds.
bool time_shield::str_to_timeframe_ms (const char *str, ts_ms_t &milliseconds) noexcept
 Parse timeframe C-string into fixed milliseconds.
bool time_shield::str_to_timeframe_ms (std::string_view str, ts_ms_t &milliseconds) noexcept
 Parse timeframe view into fixed milliseconds.
ts_t time_shield::timeframe_sec (const std::string &str) noexcept
 Convert timeframe string to fixed seconds.
ts_t time_shield::timeframe_sec (const char *str) noexcept
 Convert timeframe C-string to fixed seconds.
ts_t time_shield::timeframe_sec (std::string_view str) noexcept
 Convert timeframe view to fixed seconds.
ts_ms_t time_shield::timeframe_ms (const std::string &str) noexcept
 Convert timeframe string to fixed milliseconds.
ts_ms_t time_shield::timeframe_ms (const char *str) noexcept
 Convert timeframe C-string to fixed milliseconds.
ts_ms_t time_shield::timeframe_ms (std::string_view str) noexcept
 Convert timeframe view to fixed milliseconds.
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>
time_shield::sec_of_day (const std::string &str)
 Convert time of day string to seconds of day.
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::timeframe_is_ascii_space (const int ch)
bool time_shield::timeframe_is_ascii_digit (const int ch)
bool time_shield::timeframe_is_ascii_alpha (const int ch)
int time_shield::timeframe_ascii_to_lower (const int ch)
string time_shield::timeframe_trim_ascii (string value)
bool time_shield::timeframe_ascii_iequals (string value, string literal)
bool time_shield::timeframe_try_parse_positive_long (string value, long &out)
bool time_shield::timeframe_try_multiply_positive_long (long lhs, long rhs, long &out)
bool time_shield::timeframe_try_get_unit_seconds_compact (string unit, long &unit_seconds)
bool time_shield::timeframe_try_get_unit_seconds_word (string unit, long &unit_seconds)
bool time_shield::timeframe_try_parse_seconds (string str, long &seconds)
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::is_workday (string str)
 Parse ISO8601 string and check for workday using second precision.
bool time_shield::workday (string str)
 Alias for is_workday.
bool time_shield::is_workday_ms (string str)
 Parse ISO8601 string and check for workday using millisecond precision.
bool time_shield::workday_ms (string str)
 Alias for is_workday_ms.
bool time_shield::is_first_workday_of_month (string str)
 Parse ISO8601 string and check for the first workday of the month using second precision.
bool time_shield::is_first_workday_of_month_ms (string str)
 Parse ISO8601 string and check for the first workday of the month using millisecond precision.
bool time_shield::is_within_first_workdays_of_month (string str, int count)
 Parse ISO8601 string and check if it falls within the first N workdays of the month using second precision.
bool time_shield::is_within_first_workdays_of_month_ms (string str, int count)
 Parse ISO8601 string and check if it falls within the first N workdays of the month using millisecond precision.
bool time_shield::is_last_workday_of_month (string str)
 Parse ISO8601 string and check for the last workday of the month using second precision.
bool time_shield::is_last_workday_of_month_ms (string str)
 Parse ISO8601 string and check for the last workday of the month using millisecond precision.
bool time_shield::is_within_last_workdays_of_month (string str, int count)
 Parse ISO8601 string and check if it falls within the last N workdays of the month using second precision.
bool time_shield::is_within_last_workdays_of_month_ms (string str, int count)
 Parse ISO8601 string and check if it falls within the last N workdays of the month using millisecond precision.
long time_shield::start_of_first_workday_month (string str)
 Parse ISO8601 string and return start of the first workday of that month in seconds.
long time_shield::start_of_first_workday_month_ms (string str)
 Parse ISO8601 string and return start of the first workday of that month in milliseconds.
long time_shield::end_of_first_workday_month (string str)
 Parse ISO8601 string and return end of the first workday of that month in seconds.
long time_shield::end_of_first_workday_month_ms (string str)
 Parse ISO8601 string and return end of the first workday of that month in milliseconds.
long time_shield::start_of_last_workday_month (string str)
 Parse ISO8601 string and return start of the last workday of that month in seconds.
long time_shield::start_of_last_workday_month_ms (string str)
 Parse ISO8601 string and return start of the last workday of that month in milliseconds.
long time_shield::end_of_last_workday_month (string str)
 Parse ISO8601 string and return end of the last workday of that month in seconds.
long time_shield::end_of_last_workday_month_ms (string str)
 Parse ISO8601 string and return end of the last workday of that month in milliseconds.
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).
bool time_shield::str_to_timeframe_sec (string str, long &seconds)
 Parse timeframe string into fixed seconds.
bool time_shield::str_to_timeframe_ms (string str, long &milliseconds)
 Parse timeframe string into fixed milliseconds.
long time_shield::timeframe_sec (string str)
 Convert timeframe string to fixed seconds.
long time_shield::timeframe_ms (string str)
 Convert timeframe string to fixed milliseconds.
int time_shield::sec_of_day (string str)
 Convert string with time of day to second of day.

Detailed Description

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.

Key Features:

  • Parse ISO8601 date and time strings.
  • Extract month numbers from month names.
  • Convert parsed date and time to timestamp formats (seconds, milliseconds, floating-point).

Usage Examples:

Function Documentation

◆ end_of_first_workday_month()

long time_shield::end_of_first_workday_month ( string str)

Parse ISO8601 string and return end of the first workday of that month in seconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 23:59:59 of the first workday or ERROR_TIMESTAMP on failure.

Definition at line 514 of file time_parser.mqh.

◆ end_of_first_workday_month_ms()

long time_shield::end_of_first_workday_month_ms ( string str)

Parse ISO8601 string and return end of the first workday of that month in milliseconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 23:59:59.999 of the first workday or ERROR_TIMESTAMP on failure.

Definition at line 524 of file time_parser.mqh.

◆ end_of_last_workday_month()

long time_shield::end_of_last_workday_month ( string str)

Parse ISO8601 string and return end of the last workday of that month in seconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 23:59:59 of the last workday or ERROR_TIMESTAMP on failure.

Definition at line 554 of file time_parser.mqh.

◆ end_of_last_workday_month_ms()

long time_shield::end_of_last_workday_month_ms ( string str)

Parse ISO8601 string and return end of the last workday of that month in milliseconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 23:59:59.999 of the last workday or ERROR_TIMESTAMP on failure.

Definition at line 564 of file time_parser.mqh.

◆ fts() [1/4]

fts_t time_shield::fts ( const char * data,
std::size_t length )
inline

Convert ISO8601 character buffer to floating timestamp (seconds).

Does not require null terminator. Returns 0 on failure.

Parameters
dataPointer to character buffer.
lengthNumber of characters in buffer.
Returns
Timestamp in seconds (floating-point), or 0 if parsing fails.

Definition at line 1487 of file time_parser.hpp.

◆ fts() [2/4]

fts_t time_shield::fts ( const char * str)
inline

Convert ISO8601 C-string to floating timestamp (seconds).

Returns 0 on failure.

Parameters
strC-style string with ISO8601 timestamp, may be nullptr.
Returns
Timestamp in seconds (floating-point), or 0 if parsing fails.

Definition at line 1476 of file time_parser.hpp.

◆ fts() [3/4]

fts_t time_shield::fts ( const std::string & str)
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.

Parameters
strThe ISO8601 string.
Returns
The floating-point timestamp if successful, 0 otherwise.

Definition at line 1524 of file time_parser.hpp.

◆ fts() [4/4]

double time_shield::fts ( string str)

Convert an ISO8601 string to a floating-point timestamp (fts_t).

Returns 0.0 if parsing fails.

Parameters
strThe ISO8601 string.
Returns
Floating-point timestamp or 0.0 on error.

Definition at line 606 of file time_parser.mqh.

◆ get_month_index() [1/2]

int time_shield::get_month_index ( const std::string & month)
inline

Parse month name token into month index [1..12].

Parameters
monthMonth token.
Returns
Month index [1..12].
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 699 of file time_parser.hpp.

◆ get_month_index() [2/2]

int time_shield::get_month_index ( std::string_view month)
inline

Parse month name token into month index [1..12], string_view overload.

Definition at line 718 of file time_parser.hpp.

◆ get_month_index_enum() [1/2]

Month time_shield::get_month_index_enum ( const std::string & month)
inline

Parse month name token into Month enum.

Parameters
monthMonth token.
Returns
Month enum value (1..12).
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 707 of file time_parser.hpp.

◆ get_month_index_enum() [2/2]

Month time_shield::get_month_index_enum ( std::string_view month)
inline

Parse month name token into Month enum, string_view overload.

Definition at line 723 of file time_parser.hpp.

◆ get_month_number() [1/8]

template<class T = Month>
T time_shield::get_month_number ( const char * month)
inline

Get the month number by name (throwing), const char* overload.

Template Parameters
TReturn type, default is Month enum.
Parameters
monthMonth token C-string.
Returns
Month number (1..12) converted to T.
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 808 of file time_parser.hpp.

◆ get_month_number() [2/8]

template<class T = Month>
bool time_shield::get_month_number ( const char * month,
T & value )
inline

Alias for try_get_month_number (output parameter), const char* overload.

Definition at line 838 of file time_parser.hpp.

◆ get_month_number() [3/8]

template<class T = Month>
T time_shield::get_month_number ( const std::string & month)
inline

Get the month number by name (throwing).

Template Parameters
TReturn type, default is Month enum.
Parameters
monthMonth token.
Returns
Month number (1..12) converted to T.
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 736 of file time_parser.hpp.

◆ get_month_number() [4/8]

template<class T = Month>
bool time_shield::get_month_number ( const std::string & month,
T & value )
inline

Alias for try_get_month_number (output parameter).

Definition at line 758 of file time_parser.hpp.

◆ get_month_number() [5/8]

template<class T = Month>
T time_shield::get_month_number ( std::string_view month)
inline

Get the month number by name (throwing), string_view overload.

Definition at line 771 of file time_parser.hpp.

◆ get_month_number() [6/8]

template<class T = Month>
bool time_shield::get_month_number ( std::string_view month,
T & value )
inline

Alias for try_get_month_number, string_view overload.

Definition at line 789 of file time_parser.hpp.

◆ get_month_number() [7/8]

int time_shield::get_month_number ( string month)

Get the month number by name.

Parameters
monthThe name of the month as a string.
Returns
The month number corresponding to the given name, or 0 on error.

Definition at line 39 of file time_parser.mqh.

◆ get_month_number() [8/8]

bool time_shield::get_month_number ( string month,
int & value )

Alias for try_get_month_number function.

Try get the month number by name, with output parameter.

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 80 of file time_parser.mqh.

◆ is_first_workday_of_month() [1/2]

bool time_shield::is_first_workday_of_month ( const std::string & str)
inline

Parse ISO8601 string and check if it is the first workday of its month (seconds).

Parameters
strISO8601 formatted string.
Returns
true if parsing succeeds and the timestamp corresponds to the first workday of the month, false otherwise.

Definition at line 1348 of file time_parser.hpp.

◆ is_first_workday_of_month() [2/2]

bool time_shield::is_first_workday_of_month ( string str)

Parse ISO8601 string and check for the first workday of the month using second precision.

Parameters
strISO8601 formatted string.
Returns
true when the parsed timestamp is the first workday of its month.

Definition at line 410 of file time_parser.mqh.

◆ is_first_workday_of_month_ms() [1/2]

bool time_shield::is_first_workday_of_month_ms ( const std::string & str)
inline

Parse an ISO8601 string and check if it is the first workday of its month (millisecond precision).

Parameters
strISO8601 formatted string.
Returns
true if parsing succeeds and the timestamp corresponds to the first workday of the month, false otherwise.

Definition at line 1357 of file time_parser.hpp.

◆ is_first_workday_of_month_ms() [2/2]

bool time_shield::is_first_workday_of_month_ms ( string str)

Parse ISO8601 string and check for the first workday of the month using millisecond precision.

Parameters
strISO8601 formatted string.
Returns
true when the parsed timestamp is the first workday of its month.

Definition at line 420 of file time_parser.mqh.

◆ is_last_workday_of_month() [1/2]

bool time_shield::is_last_workday_of_month ( const std::string & str)
inline

Parse an ISO8601 string and check if it is the last workday of its month (seconds).

Parameters
strISO8601 formatted string.
Returns
true if parsing succeeds and the timestamp corresponds to the last workday of the month, false otherwise.

Definition at line 1366 of file time_parser.hpp.

◆ is_last_workday_of_month() [2/2]

bool time_shield::is_last_workday_of_month ( string str)

Parse ISO8601 string and check for the last workday of the month using second precision.

Parameters
strISO8601 formatted string.
Returns
true when the parsed timestamp is the last workday of its month.

Definition at line 452 of file time_parser.mqh.

◆ is_last_workday_of_month_ms() [1/2]

bool time_shield::is_last_workday_of_month_ms ( const std::string & str)
inline

Parse an ISO8601 string and check if it is the last workday of its month (millisecond).

Parameters
strISO8601 formatted string.
Returns
true if parsing succeeds and the timestamp corresponds to the last workday of the month, false otherwise.

Definition at line 1375 of file time_parser.hpp.

◆ is_last_workday_of_month_ms() [2/2]

bool time_shield::is_last_workday_of_month_ms ( string str)

Parse ISO8601 string and check for the last workday of the month using millisecond precision.

Parameters
strISO8601 formatted string.
Returns
true when the parsed timestamp is the last workday of its month.

Definition at line 462 of file time_parser.mqh.

◆ is_within_first_workdays_of_month() [1/2]

bool time_shield::is_within_first_workdays_of_month ( const std::string & str,
int count )
inline

Parse an ISO8601 string and check if it falls within the first N workdays of its month.

Parameters
strISO8601 formatted string.
countNumber of leading workdays to test against.
Returns
true if parsing succeeds and the timestamp corresponds to a workday ranked within the first N positions, false otherwise.

Definition at line 1385 of file time_parser.hpp.

◆ is_within_first_workdays_of_month() [2/2]

bool time_shield::is_within_first_workdays_of_month ( string str,
int count )

Parse ISO8601 string and check if it falls within the first N workdays of the month using second precision.

Parameters
strISO8601 formatted string.
countNumber of leading workdays to test.
Returns
true when the parsed timestamp is within the requested range.

Definition at line 431 of file time_parser.mqh.

◆ is_within_first_workdays_of_month_ms() [1/2]

bool time_shield::is_within_first_workdays_of_month_ms ( const std::string & str,
int count )
inline

Parse an ISO8601 string and check if it falls within the first N workdays of its month (millisecond precision).

Parameters
strISO8601 formatted string.
countNumber of leading workdays to test against.
Returns
true if parsing succeeds and the timestamp corresponds to a workday ranked within the first N positions, false otherwise.

Definition at line 1395 of file time_parser.hpp.

◆ is_within_first_workdays_of_month_ms() [2/2]

bool time_shield::is_within_first_workdays_of_month_ms ( string str,
int count )

Parse ISO8601 string and check if it falls within the first N workdays of the month using millisecond precision.

Parameters
strISO8601 formatted string.
countNumber of leading workdays to test.
Returns
true when the parsed timestamp is within the requested range.

Definition at line 442 of file time_parser.mqh.

◆ is_within_last_workdays_of_month() [1/2]

bool time_shield::is_within_last_workdays_of_month ( const std::string & str,
int count )
inline

Parse ISO8601 string and check if it is within last N workdays of its month (seconds).

Parameters
strISO8601 formatted string.
countNumber of trailing workdays to test against.
Returns
true if parsing succeeds and the timestamp corresponds to a workday ranked within the final N positions, false otherwise.

Definition at line 1405 of file time_parser.hpp.

◆ is_within_last_workdays_of_month() [2/2]

bool time_shield::is_within_last_workdays_of_month ( string str,
int count )

Parse ISO8601 string and check if it falls within the last N workdays of the month using second precision.

Parameters
strISO8601 formatted string.
countNumber of trailing workdays to test.
Returns
true when the parsed timestamp is within the requested range.

Definition at line 473 of file time_parser.mqh.

◆ is_within_last_workdays_of_month_ms() [1/2]

bool time_shield::is_within_last_workdays_of_month_ms ( const std::string & str,
int count )
inline

Parse ISO8601 string and check if it is within last N workdays of its month (milliseconds).

Parameters
strISO8601 formatted string.
countNumber of trailing workdays to test against.
Returns
true if parsing succeeds and the timestamp corresponds to a workday ranked within the final N positions, false otherwise.

Definition at line 1415 of file time_parser.hpp.

◆ is_within_last_workdays_of_month_ms() [2/2]

bool time_shield::is_within_last_workdays_of_month_ms ( string str,
int count )

Parse ISO8601 string and check if it falls within the last N workdays of the month using millisecond precision.

Parameters
strISO8601 formatted string.
countNumber of trailing workdays to test.
Returns
true when the parsed timestamp is within the requested range.

Definition at line 484 of file time_parser.mqh.

◆ is_workday() [1/2]

bool time_shield::is_workday ( const std::string & str)
inline

Parse ISO8601 string and check if it falls on a workday (seconds precision).

Definition at line 1320 of file time_parser.hpp.

◆ is_workday() [2/2]

bool time_shield::is_workday ( string str)

Parse ISO8601 string and check for workday using second precision.

Parameters
strISO8601 formatted string.
Returns
true when parsed timestamp is Monday through Friday.

Definition at line 382 of file time_parser.mqh.

◆ is_workday_ms() [1/2]

bool time_shield::is_workday_ms ( const std::string & str)
inline

Parse ISO8601 string and check if it falls on a workday (milliseconds precision).

Definition at line 1327 of file time_parser.hpp.

◆ is_workday_ms() [2/2]

bool time_shield::is_workday_ms ( string str)

Parse ISO8601 string and check for workday using millisecond precision.

Parameters
strISO8601 formatted string.
Returns
true when parsed timestamp is Monday through Friday.

Definition at line 396 of file time_parser.mqh.

◆ month_of_year() [1/8]

template<class T = Month>
T time_shield::month_of_year ( const char * month)
inline

Alias for get_month_number (throwing), const char* overload.

Definition at line 832 of file time_parser.hpp.

◆ month_of_year() [2/8]

template<class T = Month>
bool time_shield::month_of_year ( const char * month,
T & value )
inline

Alias for try_get_month_number (output parameter), const char* overload.

Definition at line 844 of file time_parser.hpp.

◆ month_of_year() [3/8]

template<class T = Month>
T time_shield::month_of_year ( const std::string & month)
inline

Alias for get_month_number (throwing).

Definition at line 742 of file time_parser.hpp.

◆ month_of_year() [4/8]

template<class T = Month>
bool time_shield::month_of_year ( const std::string & month,
T & value )
inline

Alias for try_get_month_number (output parameter).

Definition at line 764 of file time_parser.hpp.

◆ month_of_year() [5/8]

template<class T = Month>
T time_shield::month_of_year ( std::string_view month)
inline

Alias for get_month_number (throwing), string_view overload.

Definition at line 777 of file time_parser.hpp.

◆ month_of_year() [6/8]

template<class T = Month>
bool time_shield::month_of_year ( std::string_view month,
T & value )
inline

Alias for try_get_month_number, string_view overload.

Definition at line 795 of file time_parser.hpp.

◆ month_of_year() [7/8]

int time_shield::month_of_year ( string month)

Alias for get_month_number function.

Get the month number by name (throwing).

Template Parameters
TReturn type, default is Month enum.
Parameters
monthMonth token.
Returns
Month number (1..12) converted to T.
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 62 of file time_parser.mqh.

◆ month_of_year() [8/8]

bool time_shield::month_of_year ( string month,
int & value )

Alias for try_get_month_number function.

Try get the month number by name, with output parameter.

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 84 of file time_parser.mqh.

◆ parse_iso8601() [1/5]

bool time_shield::parse_iso8601 ( const char * input,
DateTimeStruct & dt,
TimeZoneStruct & tz )
inlinenoexcept

Parse ISO8601 C-string into DateTimeStruct and TimeZoneStruct.

Wrapper over parse_iso8601(const char*, std::size_t, DateTimeStruct&, TimeZoneStruct&).

Definition at line 1191 of file time_parser.hpp.

◆ parse_iso8601() [2/5]

bool time_shield::parse_iso8601 ( const char * input,
std::size_t length,
DateTimeStruct & dt,
TimeZoneStruct & tz )
inlinenoexcept

Parse ISO8601 character buffer into DateTimeStruct and TimeZoneStruct.

Supported inputs:

  • "YYYY-MM-DD"
  • "YYYY-MM-DDThh:mm"
  • "YYYY-MM-DDThh:mm:ss"
  • "YYYY-MM-DDThh:mm:ss.fff" (1..9 digits fraction; milliseconds from first 3 digits, scaled if fewer)
  • Any of the above time forms with "Z" or "+HH:MM"/"-HH:MM"
  • Separator between date and time: 'T' or ASCII whitespace.

Date separators supported: '-', '/', '.' (as in original regex). ISO week-date forms are also accepted through parse_iso_week_date(), including canonical and compatible mixed separator variants with optional weekday and uppercase or lowercase W.

Parameters
inputPointer to buffer (may be not null-terminated).
lengthBuffer length.
dtOutput DateTimeStruct (filled). On success, dt is always initialized.
tzOutput TimeZoneStruct (filled). If timezone is not present, UTC is used.
Returns
True if parsing succeeds and dt is valid, false otherwise.

Definition at line 1016 of file time_parser.hpp.

◆ parse_iso8601() [3/5]

bool time_shield::parse_iso8601 ( const std::string & input,
DateTimeStruct & dt,
TimeZoneStruct & tz )
inlinenoexcept

◆ parse_iso8601() [4/5]

bool time_shield::parse_iso8601 ( std::string_view input,
DateTimeStruct & dt,
TimeZoneStruct & tz )
inlinenoexcept

◆ parse_iso8601() [5/5]

bool time_shield::parse_iso8601 ( string input_str,
DateTimeStruct & dt,
TimeZoneStruct & tz )

Parse a date and time string in ISO8601 format.

Parameters
input_strThe input string in ISO8601 format.
dtThe DateTimeStruct to be filled with parsed values.
tzThe TimeZoneStruct to be filled with parsed time zone.
Returns
True if parsing succeeds and the date and time values are valid, false otherwise.

Definition at line 296 of file time_parser.mqh.

◆ parse_month() [1/2]

int time_shield::parse_month ( const std::string & month)
inline

Parse month name token into month index [1..12].

Parameters
monthMonth token.
Returns
Month index [1..12].
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 613 of file time_parser.hpp.

◆ parse_month() [2/2]

int time_shield::parse_month ( std::string_view month)
inline

Parse month name token into month index [1..12], string_view overload.

Parameters
monthMonth token view.
Returns
Month index [1..12].
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 630 of file time_parser.hpp.

◆ parse_month_enum() [1/2]

template<class T = Month>
T time_shield::parse_month_enum ( const std::string & month)
inline

Parse month name token into Month enum (throwing).

Template Parameters
TReturn type, default is Month enum.
Parameters
monthMonth token.
Returns
Month number (1..12) converted to T.
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 643 of file time_parser.hpp.

◆ parse_month_enum() [2/2]

template<class T = Month>
T time_shield::parse_month_enum ( std::string_view month)
inline

Parse month name token into Month enum (throwing), string_view overload.

Template Parameters
TReturn type, default is Month enum.
Parameters
monthMonth token view.
Returns
Month number (1..12) converted to T.
Exceptions
std::invalid_argumentif token is invalid.

Definition at line 667 of file time_parser.hpp.

◆ parse_time_zone() [1/3]

bool time_shield::parse_time_zone ( const char * data,
std::size_t length,
TimeZoneStruct & tz )
inlinenoexcept

Parse timezone character buffer into TimeZoneStruct.

Supported formats:

  • "" -> UTC (+00:00)
  • "Z" -> UTC (+00:00)
  • "+HH:MM" or "-HH:MM"

Parsing is syntax-oriented and accepts offsets up to 23:59. Semantic support checks for reusable library features use is_valid_tz_offset(...) and the supported UTC-offset range [-12:00, +14:00].

Parameters
dataPointer to timezone buffer (may be not null-terminated).
lengthNumber of characters in buffer.
tzOutput time zone struct.
Returns
True if parsing succeeds and tz is valid, false otherwise.

Definition at line 866 of file time_parser.hpp.

◆ parse_time_zone() [2/3]

bool time_shield::parse_time_zone ( const std::string & tz_str,
TimeZoneStruct & tz )
inlinenoexcept

Parse timezone string into TimeZoneStruct.

Wrapper over parse_time_zone(const char*, std::size_t, TimeZoneStruct&).

Definition at line 910 of file time_parser.hpp.

◆ parse_time_zone() [3/3]

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.

Parameters
tz_strThe time zone string.
tzThe TimeZoneStruct to be filled.
Returns
True if the parsing is successful and the time zone is valid, false otherwise.

Definition at line 273 of file time_parser.mqh.

◆ parse_time_zone_name() [1/4]

bool time_shield::parse_time_zone_name ( const char * data,
std::size_t length,
TimeZone & zone )
inlinenoexcept

Parse named time zone character buffer into TimeZone enum.

Supported tokens are exact uppercase repo-native abbreviations with ASCII trimming.

Parameters
dataPointer to time zone name buffer.
lengthNumber of characters in buffer.
zoneOutput named time zone.
Returns
True when parsing succeeds.

Definition at line 930 of file time_parser.hpp.

◆ parse_time_zone_name() [2/4]

bool time_shield::parse_time_zone_name ( const char * value,
TimeZone & zone )
inlinenoexcept

Parse named time zone C-string into TimeZone enum.

Wrapper over parse_time_zone_name(const char*, std::size_t, TimeZone&).

Definition at line 963 of file time_parser.hpp.

◆ parse_time_zone_name() [3/4]

bool time_shield::parse_time_zone_name ( const std::string & value,
TimeZone & zone )
inlinenoexcept

Parse named time zone string into TimeZone enum.

Wrapper over parse_time_zone_name(const char*, std::size_t, TimeZone&).

Definition at line 949 of file time_parser.hpp.

◆ parse_time_zone_name() [4/4]

bool time_shield::parse_time_zone_name ( std::string_view value,
TimeZone & zone )
inlinenoexcept

Parse named time zone string_view into TimeZone enum.

Wrapper over parse_time_zone_name(const char*, std::size_t, TimeZone&).

Definition at line 956 of file time_parser.hpp.

◆ parse_tz() [1/3]

bool time_shield::parse_tz ( const char * data,
std::size_t length,
TimeZoneStruct & tz )
inlinenoexcept

Alias for parse_time_zone (buffer overload).

Definition at line 920 of file time_parser.hpp.

◆ parse_tz() [2/3]

bool time_shield::parse_tz ( const std::string & tz_str,
TimeZoneStruct & tz )
inlinenoexcept

Alias for parse_time_zone.

Definition at line 915 of file time_parser.hpp.

◆ parse_tz() [3/3]

bool time_shield::parse_tz ( string tz_str,
TimeZoneStruct & tz )

Alias for parse_time_zone function.

Parse timezone character buffer into TimeZoneStruct.

Supported formats:

  • "" -> UTC (+00:00)
  • "Z" -> UTC (+00:00)
  • "+HH:MM" or "-HH:MM"

Parsing is syntax-oriented and accepts offsets up to 23:59. Semantic support checks for reusable library features use is_valid_tz_offset(...) and the supported UTC-offset range [-12:00, +14:00].

Parameters
dataPointer to timezone buffer (may be not null-terminated).
lengthNumber of characters in buffer.
tzOutput time zone struct.
Returns
True if parsing succeeds and tz is valid, false otherwise.

Definition at line 287 of file time_parser.mqh.

◆ parse_tz_name() [1/4]

bool time_shield::parse_tz_name ( const char * data,
std::size_t length,
TimeZone & zone )
inlinenoexcept

Alias for parse_time_zone_name.

Definition at line 972 of file time_parser.hpp.

◆ parse_tz_name() [2/4]

bool time_shield::parse_tz_name ( const char * value,
TimeZone & zone )
inlinenoexcept

Alias for parse_time_zone_name.

Definition at line 989 of file time_parser.hpp.

◆ parse_tz_name() [3/4]

bool time_shield::parse_tz_name ( const std::string & value,
TimeZone & zone )
inlinenoexcept

Alias for parse_time_zone_name.

Definition at line 977 of file time_parser.hpp.

◆ parse_tz_name() [4/4]

bool time_shield::parse_tz_name ( std::string_view value,
TimeZone & zone )
inlinenoexcept

Alias for parse_time_zone_name.

Definition at line 983 of file time_parser.hpp.

◆ sec_of_day() [1/3]

template<class T = int>
T time_shield::sec_of_day ( const std::string & str)
inline

Convert time of day string to seconds of day.

Supported formats:

  • HH:MM:SS
  • HH:MM
  • HH
Template Parameters
TReturn type (default int).
Parameters
strTime of day as string.
Returns
Parsed seconds of day or SEC_PER_DAY if parsing fails.

Definition at line 1759 of file time_parser.hpp.

◆ sec_of_day() [2/3]

template<class T = int>
bool time_shield::sec_of_day ( const std::string & str,
T & sec )
inline

Parse time of day string to seconds of day.

Supported formats:

  • HH:MM:SS
  • HH:MM
  • HH
Template Parameters
TReturn type (default int).
Parameters
strTime of day as string.
secParsed seconds of day on success.
Returns
True on successful parsing.

Definition at line 1710 of file time_parser.hpp.

◆ sec_of_day() [3/3]

int time_shield::sec_of_day ( string str)

Convert string with time of day to second of day.

Supports formats:

  • HH:MM:SS
  • HH:MM
  • HH
    Parameters
    strTime in string format
    Returns
    Second of the day if conversion succeeded, or SEC_PER_DAY if it failed.

Definition at line 671 of file time_parser.mqh.

◆ start_of_first_workday_month()

long time_shield::start_of_first_workday_month ( string str)

Parse ISO8601 string and return start of the first workday of that month in seconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 00:00:00 of the first workday or ERROR_TIMESTAMP on failure.

Definition at line 494 of file time_parser.mqh.

◆ start_of_first_workday_month_ms()

long time_shield::start_of_first_workday_month_ms ( string str)

Parse ISO8601 string and return start of the first workday of that month in milliseconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 00:00:00.000 of the first workday or ERROR_TIMESTAMP on failure.

Definition at line 504 of file time_parser.mqh.

◆ start_of_last_workday_month()

long time_shield::start_of_last_workday_month ( string str)

Parse ISO8601 string and return start of the last workday of that month in seconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 00:00:00 of the last workday or ERROR_TIMESTAMP on failure.

Definition at line 534 of file time_parser.mqh.

◆ start_of_last_workday_month_ms()

long time_shield::start_of_last_workday_month_ms ( string str)

Parse ISO8601 string and return start of the last workday of that month in milliseconds.

Parameters
strISO8601 formatted string.
Returns
Timestamp at 00:00:00.000 of the last workday or ERROR_TIMESTAMP on failure.

Definition at line 544 of file time_parser.mqh.

◆ str_to_fts() [1/3]

bool time_shield::str_to_fts ( const char * data,
std::size_t length,
fts_t & ts )
inline

Convert ISO8601 character buffer to floating-point timestamp (fts_t).

Parameters
dataPointer to character buffer.
lengthNumber of characters in buffer.
tsOutput timestamp in floating-point seconds.
Returns
True if parsing and conversion succeed, false otherwise.

Definition at line 1300 of file time_parser.hpp.

◆ str_to_fts() [2/3]

bool time_shield::str_to_fts ( const std::string & str,
fts_t & ts )
inline

Convert an ISO8601 string to a floating-point timestamp (fts_t).

Parameters
strISO8601 string.
tsOutput timestamp (floating-point seconds).
Returns
True if parsing and conversion succeed, false otherwise.

Definition at line 1284 of file time_parser.hpp.

◆ str_to_fts() [3/3]

bool time_shield::str_to_fts ( string str,
double & ts )

Convert an ISO8601 string to a floating-point timestamp (fts_t).

Parameters
strThe ISO8601 string.
tsThe floating-point timestamp to be filled.
Returns
True if the parsing and conversion are successful, false otherwise.

Definition at line 575 of file time_parser.mqh.

◆ str_to_timeframe_ms() [1/4]

bool time_shield::str_to_timeframe_ms ( const char * str,
ts_ms_t & milliseconds )
inlinenoexcept

Parse timeframe C-string into fixed milliseconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
millisecondsOutput duration in milliseconds.
Returns
True on successful parsing.

Definition at line 1587 of file time_parser.hpp.

◆ str_to_timeframe_ms() [2/4]

bool time_shield::str_to_timeframe_ms ( const std::string & str,
ts_ms_t & milliseconds )
inlinenoexcept

Parse timeframe string into fixed milliseconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
millisecondsOutput duration in milliseconds.
Returns
True on successful parsing.

Definition at line 1566 of file time_parser.hpp.

◆ str_to_timeframe_ms() [3/4]

bool time_shield::str_to_timeframe_ms ( std::string_view str,
ts_ms_t & milliseconds )
inlinenoexcept

Parse timeframe view into fixed milliseconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
millisecondsOutput duration in milliseconds.
Returns
True on successful parsing.

Definition at line 1614 of file time_parser.hpp.

◆ str_to_timeframe_ms() [4/4]

bool time_shield::str_to_timeframe_ms ( string str,
long & milliseconds )

Parse timeframe string into fixed milliseconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
millisecondsParsed duration in milliseconds.
Returns
True on successful parsing.

Definition at line 626 of file time_parser.mqh.

◆ str_to_timeframe_sec() [1/4]

bool time_shield::str_to_timeframe_sec ( const char * str,
ts_t & seconds )
inlinenoexcept

Parse timeframe C-string into fixed seconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
secondsOutput duration in seconds.
Returns
True on successful parsing.

Definition at line 1544 of file time_parser.hpp.

◆ str_to_timeframe_sec() [2/4]

bool time_shield::str_to_timeframe_sec ( const std::string & str,
ts_t & seconds )
inlinenoexcept

Parse timeframe string into fixed seconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
secondsOutput duration in seconds.
Returns
True on successful parsing.

Definition at line 1536 of file time_parser.hpp.

◆ str_to_timeframe_sec() [3/4]

bool time_shield::str_to_timeframe_sec ( std::string_view str,
ts_t & seconds )
inlinenoexcept

Parse timeframe view into fixed seconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
secondsOutput duration in seconds.
Returns
True on successful parsing.

Definition at line 1557 of file time_parser.hpp.

◆ str_to_timeframe_sec() [4/4]

bool time_shield::str_to_timeframe_sec ( string str,
long & seconds )

Parse timeframe string into fixed seconds.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
secondsParsed duration in seconds.
Returns
True on successful parsing.

Definition at line 618 of file time_parser.mqh.

◆ str_to_ts() [1/3]

bool time_shield::str_to_ts ( const char * data,
std::size_t length,
ts_t & ts )
inline

Parse ISO8601 character buffer and convert to timestamp (seconds).

Parameters
dataPointer to character buffer.
lengthBuffer length in bytes.
tsOutput timestamp in seconds.
Returns
true if parsing succeeds, false otherwise.

Definition at line 1230 of file time_parser.hpp.

◆ str_to_ts() [2/3]

bool time_shield::str_to_ts ( const std::string & str,
ts_t & ts )
inline

Convert an ISO8601 string to a timestamp (ts_t).

Parameters
strISO8601 string.
tsOutput timestamp (seconds).
Returns
True if parsing and conversion succeed, false otherwise.

Definition at line 1214 of file time_parser.hpp.

◆ str_to_ts() [3/3]

bool time_shield::str_to_ts ( string str,
long & ts )

Convert an ISO8601 string to a timestamp (ts_t).

Parameters
strThe ISO8601 string.
tsThe timestamp to be filled.
Returns
True if the parsing and conversion are successful, false otherwise.

Definition at line 361 of file time_parser.mqh.

◆ str_to_ts_ms() [1/3]

bool time_shield::str_to_ts_ms ( const char * data,
std::size_t length,
ts_ms_t & ts )
inline

Convert ISO8601 character buffer to millisecond timestamp (ts_ms_t).

Parameters
dataPointer to character buffer.
lengthNumber of characters in buffer.
tsOutput timestamp in milliseconds.
Returns
True if parsing and conversion succeed, false otherwise.

Definition at line 1265 of file time_parser.hpp.

◆ str_to_ts_ms() [2/3]

bool time_shield::str_to_ts_ms ( const std::string & str,
ts_ms_t & ts )
inline

Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).

Parameters
strISO8601 string.
tsOutput timestamp (milliseconds).
Returns
True if parsing and conversion succeed, false otherwise.

Definition at line 1249 of file time_parser.hpp.

◆ str_to_ts_ms() [3/3]

bool time_shield::str_to_ts_ms ( string str,
long & ts )

Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).

Parameters
strThe ISO8601 string.
tsThe millisecond timestamp to be filled.
Returns
True if the parsing and conversion are successful, false otherwise.

Definition at line 372 of file time_parser.mqh.

◆ timeframe_ascii_iequals()

bool time_shield::timeframe_ascii_iequals ( string value,
string literal )

Definition at line 116 of file time_parser.mqh.

◆ timeframe_ascii_to_lower()

int time_shield::timeframe_ascii_to_lower ( const int ch)

Definition at line 100 of file time_parser.mqh.

◆ timeframe_is_ascii_alpha()

bool time_shield::timeframe_is_ascii_alpha ( const int ch)

Definition at line 96 of file time_parser.mqh.

◆ timeframe_is_ascii_digit()

bool time_shield::timeframe_is_ascii_digit ( const int ch)

Definition at line 92 of file time_parser.mqh.

◆ timeframe_is_ascii_space()

bool time_shield::timeframe_is_ascii_space ( const int ch)

Definition at line 88 of file time_parser.mqh.

◆ timeframe_ms() [1/4]

ts_ms_t time_shield::timeframe_ms ( const char * str)
inlinenoexcept

Convert timeframe C-string to fixed milliseconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in milliseconds, or 0 on failure.

Definition at line 1678 of file time_parser.hpp.

◆ timeframe_ms() [2/4]

ts_ms_t time_shield::timeframe_ms ( const std::string & str)
inlinenoexcept

Convert timeframe string to fixed milliseconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in milliseconds, or 0 on failure.

Definition at line 1668 of file time_parser.hpp.

◆ timeframe_ms() [3/4]

ts_ms_t time_shield::timeframe_ms ( std::string_view str)
inlinenoexcept

Convert timeframe view to fixed milliseconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in milliseconds, or 0 on failure.

Definition at line 1689 of file time_parser.hpp.

◆ timeframe_ms() [4/4]

long time_shield::timeframe_ms ( string str)

Convert timeframe string to fixed milliseconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in milliseconds, or 0 on failure.

Definition at line 655 of file time_parser.mqh.

◆ timeframe_sec() [1/4]

ts_t time_shield::timeframe_sec ( const char * str)
inlinenoexcept

Convert timeframe C-string to fixed seconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in seconds, or 0 on failure.

Definition at line 1646 of file time_parser.hpp.

◆ timeframe_sec() [2/4]

ts_t time_shield::timeframe_sec ( const std::string & str)
inlinenoexcept

Convert timeframe string to fixed seconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in seconds, or 0 on failure.

Definition at line 1636 of file time_parser.hpp.

◆ timeframe_sec() [3/4]

ts_t time_shield::timeframe_sec ( std::string_view str)
inlinenoexcept

Convert timeframe view to fixed seconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in seconds, or 0 on failure.

Definition at line 1657 of file time_parser.hpp.

◆ timeframe_sec() [4/4]

long time_shield::timeframe_sec ( string str)

Convert timeframe string to fixed seconds.

Returns 0 if parsing fails.

Parameters
strTimeframe string such as "M15", "hour", or "2 weeks".
Returns
Parsed duration in seconds, or 0 on failure.

Definition at line 645 of file time_parser.mqh.

◆ timeframe_trim_ascii()

string time_shield::timeframe_trim_ascii ( string value)

Definition at line 106 of file time_parser.mqh.

◆ timeframe_try_get_unit_seconds_compact()

bool time_shield::timeframe_try_get_unit_seconds_compact ( string unit,
long & unit_seconds )

Definition at line 165 of file time_parser.mqh.

◆ timeframe_try_get_unit_seconds_word()

bool time_shield::timeframe_try_get_unit_seconds_word ( string unit,
long & unit_seconds )

Definition at line 179 of file time_parser.mqh.

◆ timeframe_try_multiply_positive_long()

bool time_shield::timeframe_try_multiply_positive_long ( long lhs,
long rhs,
long & out )

Definition at line 154 of file time_parser.mqh.

◆ timeframe_try_parse_positive_long()

bool time_shield::timeframe_try_parse_positive_long ( string value,
long & out )

Definition at line 130 of file time_parser.mqh.

◆ timeframe_try_parse_seconds()

bool time_shield::timeframe_try_parse_seconds ( string str,
long & seconds )

Definition at line 193 of file time_parser.mqh.

◆ try_get_month_index() [1/2]

bool time_shield::try_get_month_index ( const std::string & month,
int & value )
inline

Try parse month name token into month index [1..12].

Parameters
monthMonth token (e.g. "Jan", "January"), case-insensitive.
valueOutput month index [1..12].
Returns
True on success, false otherwise.

Definition at line 691 of file time_parser.hpp.

◆ try_get_month_index() [2/2]

bool time_shield::try_get_month_index ( std::string_view month,
int & value )
inline

Try parse month name token into month index [1..12], string_view overload.

Definition at line 713 of file time_parser.hpp.

◆ try_get_month_number() [1/4]

template<class T = Month>
bool time_shield::try_get_month_number ( const char * month,
T & value )
inline

Try get the month number by name, const char* overload.

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token C-string.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 822 of file time_parser.hpp.

◆ try_get_month_number() [2/4]

template<class T = Month>
bool time_shield::try_get_month_number ( const std::string & month,
T & value )
inline

Try get the month number by name, with output parameter.

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 752 of file time_parser.hpp.

◆ try_get_month_number() [3/4]

template<class T = Month>
bool time_shield::try_get_month_number ( std::string_view month,
T & value )
inline

Try get the month number by name, string_view overload.

Definition at line 783 of file time_parser.hpp.

◆ try_get_month_number() [4/4]

bool time_shield::try_get_month_number ( string month,
int & value )

Get the month number by name, with output parameter.

Parameters
monthThe name of the month as a string.
valueReference to store the month number if found.
Returns
True if the month name is valid, false otherwise.

Definition at line 70 of file time_parser.mqh.

◆ try_parse_format() [1/4]

bool time_shield::try_parse_format ( const char * data,
const char * format,
DateTimeStruct & out_dt,
TimeZoneStruct & out_tz )
inlinenoexcept

Parse null-terminated strings using formatter-compatible custom pattern.

Definition at line 1077 of file time_format_parser.hpp.

◆ try_parse_format() [2/4]

bool time_shield::try_parse_format ( const char * data,
std::size_t length,
const char * format,
std::size_t format_length,
DateTimeStruct & out_dt,
TimeZoneStruct & out_tz )
inlinenoexcept

Parse input using formatter-compatible custom pattern.

ISO week-based tokens G, g, V, and u follow the same grammar as formatter output. Formats using ISO week-based year/week tokens do not mix with Gregorian Y / m / d date tokens.

Definition at line 1009 of file time_format_parser.hpp.

◆ try_parse_format() [3/4]

bool time_shield::try_parse_format ( const std::string & data,
const std::string & format,
DateTimeStruct & out_dt,
TimeZoneStruct & out_tz )
inlinenoexcept

Parse std::string using formatter-compatible custom pattern.

Definition at line 1067 of file time_format_parser.hpp.

◆ try_parse_format() [4/4]

bool time_shield::try_parse_format ( std::string_view data,
std::string_view format,
DateTimeStruct & out_dt,
TimeZoneStruct & out_tz )
inlinenoexcept

Parse std::string_view using formatter-compatible custom pattern.

Definition at line 1135 of file time_format_parser.hpp.

◆ try_parse_format_ts() [1/4]

bool time_shield::try_parse_format_ts ( const char * data,
const char * format,
ts_t & out_ts )
inlinenoexcept

Parse null-terminated strings using custom format and convert to UTC seconds.

Definition at line 1099 of file time_format_parser.hpp.

◆ try_parse_format_ts() [2/4]

bool time_shield::try_parse_format_ts ( const char * data,
std::size_t length,
const char * format,
std::size_t format_length,
ts_t & out_ts )
inlinenoexcept

Parse input using formatter-compatible custom pattern and convert to UTC seconds.

Definition at line 1021 of file time_format_parser.hpp.

◆ try_parse_format_ts() [3/4]

bool time_shield::try_parse_format_ts ( const std::string & data,
const std::string & format,
ts_t & out_ts )
inlinenoexcept

Parse std::string using formatter-compatible custom pattern and convert to UTC seconds.

Definition at line 1090 of file time_format_parser.hpp.

◆ try_parse_format_ts() [4/4]

bool time_shield::try_parse_format_ts ( std::string_view data,
std::string_view format,
ts_t & out_ts )
inlinenoexcept

Parse std::string_view using formatter-compatible custom pattern and convert to UTC seconds.

Definition at line 1145 of file time_format_parser.hpp.

◆ try_parse_format_ts_ms() [1/4]

bool time_shield::try_parse_format_ts_ms ( const char * data,
const char * format,
ts_ms_t & out_ts )
inlinenoexcept

Parse null-terminated strings using custom format and convert to UTC milliseconds.

Definition at line 1121 of file time_format_parser.hpp.

◆ try_parse_format_ts_ms() [2/4]

bool time_shield::try_parse_format_ts_ms ( const char * data,
std::size_t length,
const char * format,
std::size_t format_length,
ts_ms_t & out_ts )
inlinenoexcept

Parse input using formatter-compatible custom pattern and convert to UTC milliseconds.

Definition at line 1044 of file time_format_parser.hpp.

◆ try_parse_format_ts_ms() [3/4]

bool time_shield::try_parse_format_ts_ms ( const std::string & data,
const std::string & format,
ts_ms_t & out_ts )
inlinenoexcept

Parse std::string using formatter-compatible custom pattern and convert to UTC milliseconds.

Definition at line 1112 of file time_format_parser.hpp.

◆ try_parse_format_ts_ms() [4/4]

bool time_shield::try_parse_format_ts_ms ( std::string_view data,
std::string_view format,
ts_ms_t & out_ts )
inlinenoexcept

Parse std::string_view using formatter-compatible custom pattern and convert to UTC milliseconds.

Definition at line 1154 of file time_format_parser.hpp.

◆ try_parse_month() [1/2]

bool time_shield::try_parse_month ( const std::string & month,
int & value )
inline

Try parse month name token into month index [1..12].

Parameters
monthMonth token (e.g. "Jan", "January"), case-insensitive.
valueOutput month index [1..12].
Returns
True on success, false otherwise.

Definition at line 605 of file time_parser.hpp.

◆ try_parse_month() [2/2]

bool time_shield::try_parse_month ( std::string_view month,
int & value )
inline

Try parse month name token into month index [1..12], string_view overload.

Parameters
monthMonth token view (e.g. "Jan", "January"), case-insensitive.
valueOutput month index [1..12].
Returns
True on success, false otherwise.

Definition at line 622 of file time_parser.hpp.

◆ try_parse_month_enum() [1/2]

template<class T = Month>
bool time_shield::try_parse_month_enum ( const std::string & month,
T & value )
inline

Try parse month name token into Month enum (or any T).

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 653 of file time_parser.hpp.

◆ try_parse_month_enum() [2/2]

template<class T = Month>
bool time_shield::try_parse_month_enum ( std::string_view month,
T & value )
inline

Try parse month name token into Month enum (or any T), string_view overload.

Template Parameters
TOutput type, default is Month enum.
Parameters
monthMonth token view.
valueOutput month number (1..12) converted to T.
Returns
True if month token is valid, false otherwise.

Definition at line 677 of file time_parser.hpp.

◆ ts() [1/4]

ts_t time_shield::ts ( const char * data,
std::size_t length )
inline

Convert ISO8601 character buffer to timestamp (seconds).

Does not require null terminator. Returns 0 on failure (ambiguous if epoch is a valid value for your usage).

Parameters
dataPointer to character buffer.
lengthNumber of characters in buffer.
Returns
Timestamp in seconds, or 0 if parsing fails.

Definition at line 1441 of file time_parser.hpp.

◆ ts() [2/4]

ts_t time_shield::ts ( const char * str)
inline

Convert ISO8601 C-string to timestamp (seconds).

Returns 0 on failure (ambiguous if epoch is a valid value for your usage).

Parameters
strC-style string with ISO8601 timestamp, may be nullptr.
Returns
Timestamp in seconds, or 0 if parsing fails.

Definition at line 1429 of file time_parser.hpp.

◆ ts() [3/4]

ts_t time_shield::ts ( const std::string & str)
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.

Parameters
strThe ISO8601 string.
Returns
The timestamp value. Returns 0 if parsing fails.

Definition at line 1502 of file time_parser.hpp.

◆ ts() [4/4]

long time_shield::ts ( string str)

Convert an ISO8601 string to a timestamp (ts_t).

Returns 0 if parsing fails.

Parameters
strThe ISO8601 string.
Returns
Timestamp value or 0 on error.

Definition at line 586 of file time_parser.mqh.

◆ ts_ms() [1/4]

ts_ms_t time_shield::ts_ms ( const char * data,
std::size_t length )
inline

Convert ISO8601 character buffer to timestamp (milliseconds).

Does not require null terminator. Returns 0 on failure.

Parameters
dataPointer to character buffer.
lengthNumber of characters in buffer.
Returns
Timestamp in milliseconds, or 0 if parsing fails.

Definition at line 1464 of file time_parser.hpp.

◆ ts_ms() [2/4]

ts_ms_t time_shield::ts_ms ( const char * str)
inline

Convert ISO8601 C-string to timestamp (milliseconds).

Returns 0 on failure (ambiguous if epoch is a valid value for your usage).

Parameters
strC-style string with ISO8601 timestamp, may be nullptr.
Returns
Timestamp in milliseconds, or 0 if parsing fails.

Definition at line 1453 of file time_parser.hpp.

◆ ts_ms() [3/4]

ts_ms_t time_shield::ts_ms ( const std::string & str)
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.

Parameters
strThe ISO8601 string.
Returns
The parsed millisecond timestamp, or 0 if parsing fails.

Definition at line 1513 of file time_parser.hpp.

◆ ts_ms() [4/4]

long time_shield::ts_ms ( string str)

Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).

Returns 0 if parsing fails.

Parameters
strThe ISO8601 string.
Returns
Millisecond timestamp value or 0 on error.

Definition at line 596 of file time_parser.mqh.

◆ workday() [1/2]

bool time_shield::workday ( const std::string & str)
inline

Alias for is_workday(const std::string&).

Parse ISO8601 string and check if it falls on a workday (seconds precision).

Definition at line 1335 of file time_parser.hpp.

◆ workday() [2/2]

bool time_shield::workday ( string str)

Alias for is_workday.

Parse ISO8601 string and check for workday using second precision.

Parameters
strISO8601 formatted string.
Returns
true when parsed timestamp is Monday through Friday.

Definition at line 391 of file time_parser.mqh.

◆ workday_ms() [1/2]

bool time_shield::workday_ms ( const std::string & str)
inline

Alias for is_workday_ms(const std::string&).

Parse ISO8601 string and check if it falls on a workday (milliseconds precision).

Definition at line 1341 of file time_parser.hpp.

◆ workday_ms() [2/2]

bool time_shield::workday_ms ( string str)

Alias for is_workday_ms.

Parse ISO8601 string and check for workday using millisecond precision.

Parameters
strISO8601 formatted string.
Returns
true when parsed timestamp is Monday through Friday.

Definition at line 405 of file time_parser.mqh.