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...

Functions

template<class T = Month>
time_shield::get_month_number (const std::string &month)
 Get the month number by name.
 
template<class T = Month>
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::is_workday (const std::string &str)
 Parse an ISO8601 string and check if it falls on a workday using second precision.
 
bool time_shield::is_workday_ms (const std::string &str)
 Parse an ISO8601 string and check if it falls on a workday using millisecond 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 an ISO8601 string and check if it is the first workday of its month.
 
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_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_last_workday_of_month (const std::string &str)
 Parse an ISO8601 string and check if it is the last workday of its month.
 
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 precision).
 
bool time_shield::is_within_last_workdays_of_month (const std::string &str, int count)
 Parse an ISO8601 string and check if it falls within the last N workdays of its month.
 
bool time_shield::is_within_last_workdays_of_month_ms (const std::string &str, int count)
 Parse an ISO8601 string and check if it falls within the last N workdays of its month (millisecond precision).
 
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>
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::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.
 
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.
 

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:

Usage Examples:

Function Documentation

◆ fts() [1/3]

fts_t time_shield::fts ( const char * str)
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.

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

Definition at line 535 of file time_parser.hpp.

◆ fts() [2/3]

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 431 of file time_parser.hpp.

◆ fts() [3/3]

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 344 of file time_parser.mqh.

◆ get_month_number() [1/4]

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

Get the month number by name.

Template Parameters
TThe return type, default is Month enum.
Parameters
monthThe name of the month as a string.
Returns
The month number corresponding to the given name.
Exceptions
std::invalid_argumentif the month name is invalid.

Definition at line 66 of file time_parser.hpp.

◆ get_month_number() [2/4]

template<class T = Month>
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.

Template Parameters
TThe type for the month number, default is Month enum.
Parameters
monthThe name of the month as a string.
valueThe reference to store the month number if found.
Returns
True if the month name is valid, false otherwise.

Definition at line 137 of file time_parser.hpp.

◆ get_month_number() [3/4]

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() [4/4]

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.

Template Parameters
TThe type for the month number, default is Month enum.
Parameters
monthThe name of the month as a string.
valueThe reference to store the month number if found.
Returns
True if the month name 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 an ISO8601 string and check if it is the first workday of its month.

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 299 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 228 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 310 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 238 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.

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 345 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 270 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 precision).

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 356 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 280 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 322 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 249 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 334 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 260 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 an ISO8601 string and check if it falls within the last N workdays of its month.

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 368 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 291 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 an ISO8601 string and check if it falls within the last N workdays of its month (millisecond precision).

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 380 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 302 of file time_parser.mqh.

◆ is_workday() [1/2]

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

Parse an ISO8601 string and check if it falls on a workday using second precision.

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

Definition at line 265 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 200 of file time_parser.mqh.

◆ is_workday_ms() [1/2]

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

Parse an ISO8601 string and check if it falls on a workday using millisecond precision.

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

Definition at line 276 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 214 of file time_parser.mqh.

◆ month_of_year() [1/4]

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

Alias for get_month_number function.

Get the month number by name.

Template Parameters
TThe return type, default is Month enum.
Parameters
monthThe name of the month as a string.
Returns
The month number corresponding to the given name.
Exceptions
std::invalid_argumentif the month name is invalid.

Definition at line 95 of file time_parser.hpp.

◆ month_of_year() [2/4]

template<class T = Month>
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.

Template Parameters
TThe type for the month number, default is Month enum.
Parameters
monthThe name of the month as a string.
valueThe reference to store the month number if found.
Returns
True if the month name is valid, false otherwise.

Definition at line 144 of file time_parser.hpp.

◆ month_of_year() [3/4]

int time_shield::month_of_year ( string month)

Alias for get_month_number function.

Get the month number by name.

Template Parameters
TThe return type, default is Month enum.
Parameters
monthThe name of the month as a string.
Returns
The month number corresponding to the given name.
Exceptions
std::invalid_argumentif the month name is invalid.

Definition at line 62 of file time_parser.mqh.

◆ month_of_year() [4/4]

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.

Template Parameters
TThe type for the month number, default is Month enum.
Parameters
monthThe name of the month as a string.
valueThe reference to store the month number if found.
Returns
True if the month name is valid, false otherwise.

Definition at line 84 of file time_parser.mqh.

◆ parse_iso8601() [1/2]

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

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.

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

Definition at line 190 of file time_parser.hpp.

◆ parse_iso8601() [2/2]

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 117 of file time_parser.mqh.

◆ parse_time_zone() [1/2]

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

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.

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 156 of file time_parser.hpp.

◆ parse_time_zone() [2/2]

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 94 of file time_parser.mqh.

◆ parse_tz() [1/2]

bool time_shield::parse_tz ( const std::string & tz_str,
TimeZoneStruct & tz )
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.

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 177 of file time_parser.hpp.

◆ parse_tz() [2/2]

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.

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 108 of file time_parser.mqh.

◆ 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 500 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 451 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 360 of file time_parser.mqh.

◆ str_to_fts() [1/2]

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).

This function parses a string in ISO8601 format and converts it to a floating-point timestamp.

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 393 of file time_parser.hpp.

◆ str_to_fts() [2/2]

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 313 of file time_parser.mqh.

◆ str_to_ts() [1/2]

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

Convert an ISO8601 string to a timestamp (ts_t).

This function parses a string in ISO8601 format and converts it to a timestamp.

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

Definition at line 235 of file time_parser.hpp.

◆ str_to_ts() [2/2]

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 179 of file time_parser.mqh.

◆ str_to_ts_ms() [1/2]

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).

This function parses a string in ISO8601 format and converts it to a millisecond timestamp.

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

Definition at line 251 of file time_parser.hpp.

◆ str_to_ts_ms() [2/2]

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 190 of file time_parser.mqh.

◆ try_get_month_number() [1/2]

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 Parameters
TThe type for the month number, default is Month enum.
Parameters
monthThe name of the month as a string.
valueThe reference to store the month number if found.
Returns
True if the month name is valid, false otherwise.

Definition at line 107 of file time_parser.hpp.

◆ try_get_month_number() [2/2]

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.

◆ ts() [1/3]

ts_t time_shield::ts ( const char * str)
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.

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

Definition at line 513 of file time_parser.hpp.

◆ ts() [2/3]

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 409 of file time_parser.hpp.

◆ ts() [3/3]

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 324 of file time_parser.mqh.

◆ ts_ms() [1/3]

ts_ms_t time_shield::ts_ms ( const char * str)
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.

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

Definition at line 524 of file time_parser.hpp.

◆ ts_ms() [2/3]

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 420 of file time_parser.hpp.

◆ ts_ms() [3/3]

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 334 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 an ISO8601 string and check if it falls on a workday using second precision.

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

Definition at line 286 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 209 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 an ISO8601 string and check if it falls on a workday using millisecond precision.

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

Definition at line 292 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 223 of file time_parser.mqh.