Time Shield Library
C++ library for working with time
|
A comprehensive set of functions for validating dates, times, leap years, and time zones. More...
Functions | |
template<class T = year_t> | |
constexpr const bool | time_shield::is_leap_year_date (T year) noexcept |
Checks if the given year is a leap year. | |
template<class T = year_t> | |
constexpr const bool | time_shield::check_leap_year (T year) noexcept |
Alias for is_leap_year_date function. | |
template<class T = year_t> | |
constexpr const bool | time_shield::leap_year (T year) noexcept |
Alias for is_leap_year_date function. | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_leap_year_ts (ts_t ts) |
Checks if the given year is a leap year. | |
TIME_SHIELD_CONSTEXPR bool | time_shield::leap_year_ts (ts_t ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR bool | time_shield::check_leap_year_ts (ts_t ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_leap_year (ts_t ts) |
Alias for is_leap_year_ts function. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_valid_time_zone (T hour, T min) noexcept |
Check if the time zone is valid. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_valid_tz (T hour, T min) |
Alias for is_valid_time_zone function. | |
template<class T1 = int, class T2 = int> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_valid_time (T1 hour, T1 min, T1 sec, T2 ms=0) noexcept |
Checks the correctness of the specified time. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_valid_date (T1 year, T2 month, T2 day) noexcept |
Checks the correctness of the specified date. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_valid_date_time (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0) noexcept |
Checks the correctness of a date and time. | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_day_off (ts_t ts) noexcept |
Check if a given timestamp corresponds to a weekend day (Saturday or Sunday). | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_weekend (ts_t ts) noexcept |
Alias for is_day_off function. | |
template<class T = uday_t> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_day_off_unix_day (T unix_day) noexcept |
Check if a given day (since Unix epoch) corresponds to a weekend day (Saturday or Sunday). This function checks if the given day (number of days since Unix epoch) falls on a weekend day, which is either Saturday or Sunday. | |
template<class T = uday_t> | |
TIME_SHIELD_CONSTEXPR bool | time_shield::is_weekend_unix_day (T unix_day) noexcept |
Alias for is_day_off_unix_day function. | |
bool | time_shield::is_leap_year_date (const long year) |
Checks if the given year is a leap year. | |
bool | time_shield::check_leap_year (const long year) |
Alias for is_leap_year_date. | |
bool | time_shield::leap_year (const long year) |
Alias for is_leap_year_date. | |
bool | time_shield::is_leap_year_ts (const long ts) |
Checks if the year of the given timestamp is a leap year. | |
bool | time_shield::leap_year_ts (const long ts) |
Alias for is_leap_year_ts. | |
bool | time_shield::check_leap_year_ts (const long ts) |
Alias for is_leap_year_ts. | |
bool | time_shield::is_leap_year (const long ts) |
Alias for is_leap_year_ts. | |
bool | time_shield::is_valid_time_zone (const int hour, const int min) |
Check if the time zone components are valid. | |
bool | time_shield::is_valid_tz (const int hour, const int min) |
Alias for is_valid_time_zone. | |
bool | time_shield::is_valid_time_zone_offset (const TimeZoneStruct &time_zone) |
Check if the time zone structure is valid. | |
bool | time_shield::is_valid_time_zone (const TimeZoneStruct &time_zone) |
Alias for is_valid_time_zone_offset. | |
bool | time_shield::is_valid_tz (const TimeZoneStruct &time_zone) |
Alias for is_valid_time_zone_offset. | |
bool | time_shield::is_valid_time (const int hour, const int min, const int sec, const int ms=0) |
Checks the correctness of the specified time. | |
bool | time_shield::is_valid_time (const TimeStruct &time) |
Checks the correctness of the specified time structure. | |
bool | time_shield::is_valid_date (const long year, const int month, const int day) |
Checks the correctness of the specified date. | |
bool | time_shield::is_valid_date (const DateStruct &date) |
Checks the correctness of the specified date structure. | |
bool | time_shield::is_valid_date_time (const long year, const int month, const int day, const int hour=0, const int min=0, const int sec=0, const int ms=0) |
Checks the correctness of date and time components. | |
bool | time_shield::is_valid_date_time (const DateTimeStruct &date_time) |
Checks the correctness of the date-time structure. | |
bool | time_shield::is_day_off (const long ts) |
Check if a timestamp corresponds to a weekend day. | |
bool | time_shield::is_weekend (const long ts) |
Alias for is_day_off. | |
bool | time_shield::is_day_off_unix_day (const long unix_day) |
Check if a Unix day corresponds to a weekend day. | |
bool | time_shield::is_weekend_unix_day (const long unix_day) |
Alias for is_day_off_unix_day. | |
A comprehensive set of functions for validating dates, times, leap years, and time zones.
Functions for validating dates, times and time zones.
This module provides functionalities to validate the correctness of date-time values, leap years, and time zone offsets. It also includes utilities for determining weekends and ensuring the validity of timestamp-based calculations.
bool time_shield::check_leap_year | ( | const long | year | ) |
Alias for is_leap_year_date.
Checks if the given year is a leap year.
T | The type of the year (default is year_t). |
year | Year to check. |
Definition at line 43 of file validation.mqh.
|
constexprnoexcept |
Alias for is_leap_year_date function.
Checks if the given year is a leap year.
T | The type of the year (default is year_t). |
year | Year to check. |
Definition at line 61 of file validation.hpp.
bool time_shield::check_leap_year_ts | ( | const long | ts | ) |
Alias for is_leap_year_ts.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 87 of file validation.mqh.
TIME_SHIELD_CONSTEXPR bool time_shield::check_leap_year_ts | ( | ts_t | ts | ) |
Alias for is_leap_year_ts function.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 120 of file validation.hpp.
bool time_shield::is_day_off | ( | const long | ts | ) |
Check if a timestamp corresponds to a weekend day.
ts | Timestamp to check. |
Definition at line 226 of file validation.mqh.
|
inlinenoexcept |
Check if a given timestamp corresponds to a weekend day (Saturday or Sunday).
This function checks if the given timestamp falls on a weekend day, which is either Saturday or Sunday.
ts | Timestamp to check (default: current timestamp). |
Definition at line 313 of file validation.hpp.
bool time_shield::is_day_off_unix_day | ( | const long | unix_day | ) |
Check if a Unix day corresponds to a weekend day.
unix_day | Number of days since Unix epoch. |
Definition at line 238 of file validation.mqh.
|
inlinenoexcept |
Check if a given day (since Unix epoch) corresponds to a weekend day (Saturday or Sunday). This function checks if the given day (number of days since Unix epoch) falls on a weekend day, which is either Saturday or Sunday.
unix_day | Day to check (number of days since Unix epoch). |
Definition at line 332 of file validation.hpp.
bool time_shield::is_leap_year | ( | const long | ts | ) |
Alias for is_leap_year_ts.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 91 of file validation.mqh.
TIME_SHIELD_CONSTEXPR bool time_shield::is_leap_year | ( | ts_t | ts | ) |
Alias for is_leap_year_ts function.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 126 of file validation.hpp.
bool time_shield::is_leap_year_date | ( | const long | year | ) |
Checks if the given year is a leap year.
year | Year to check. |
Definition at line 37 of file validation.mqh.
|
constexprnoexcept |
Checks if the given year is a leap year.
T | The type of the year (default is year_t). |
year | Year to check. |
Definition at line 54 of file validation.hpp.
bool time_shield::is_leap_year_ts | ( | const long | ts | ) |
Checks if the year of the given timestamp is a leap year.
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 54 of file validation.mqh.
TIME_SHIELD_CONSTEXPR bool time_shield::is_leap_year_ts | ( | ts_t | ts | ) |
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 82 of file validation.hpp.
bool time_shield::is_valid_date | ( | const DateStruct & | date | ) |
Checks the correctness of the specified date structure.
date | Date structure. |
Definition at line 186 of file validation.mqh.
bool time_shield::is_valid_date | ( | const long | year, |
const int | month, | ||
const int | day ) |
Checks the correctness of the specified date.
year | Year component. |
month | Month component. |
day | Day component. |
Definition at line 158 of file validation.mqh.
|
inlinenoexcept |
Checks the correctness of the specified date.
T1 | The type of the year or day value (default is year_t). |
T2 | The type of the month and day values (default is int). |
year | Year or day. |
month | Month. |
day | Day or year. |
Definition at line 228 of file validation.hpp.
bool time_shield::is_valid_date_time | ( | const DateTimeStruct & | date_time | ) |
Checks the correctness of the date-time structure.
date_time | Date-time structure. |
Definition at line 215 of file validation.mqh.
bool time_shield::is_valid_date_time | ( | const long | year, |
const int | month, | ||
const int | day, | ||
const int | hour = 0, | ||
const int | min = 0, | ||
const int | sec = 0, | ||
const int | ms = 0 ) |
Checks the correctness of date and time components.
year | Year component. |
month | Month component. |
day | Day component. |
hour | Hour component (default is 0). |
min | Minute component (default is 0). |
sec | Second component (default is 0). |
ms | Millisecond component (default is 0). |
Definition at line 199 of file validation.mqh.
|
inlinenoexcept |
Checks the correctness of a date and time.
T1 | The type of the year or day value (default is year_t). |
T2 | The type of the month and day values (default is int). |
T3 | The type of the millisecond value (default is int). |
year | Year or day. |
month | Month. |
day | Day or year. |
hour | Hour (default is 0). |
min | Minute (default is 0). |
sec | Second (default is 0). |
ms | Millisecond (default is 0). |
Definition at line 279 of file validation.hpp.
bool time_shield::is_valid_time | ( | const int | hour, |
const int | min, | ||
const int | sec, | ||
const int | ms = 0 ) |
Checks the correctness of the specified time.
hour | Hour component. |
min | Minute component. |
sec | Second component. |
ms | Millisecond component (default is 0). |
Definition at line 138 of file validation.mqh.
bool time_shield::is_valid_time | ( | const TimeStruct & | time | ) |
Checks the correctness of the specified time structure.
time | Time structure. |
Definition at line 149 of file validation.mqh.
|
inlinenoexcept |
Checks the correctness of the specified time.
T1 | The type of the hour, minute, and second values (default is int). |
T2 | The type of the millisecond value (default is int). |
hour | Hour |
min | Minute |
sec | Second |
ms | Millisecond (default is 0). |
Definition at line 197 of file validation.hpp.
bool time_shield::is_valid_time_zone | ( | const int | hour, |
const int | min ) |
Check if the time zone components are valid.
hour | The hour component of the time zone. |
min | The minute component of the time zone. |
Definition at line 99 of file validation.mqh.
bool time_shield::is_valid_time_zone | ( | const TimeZoneStruct & | time_zone | ) |
Alias for is_valid_time_zone_offset.
Check if the time zone is valid.
T | The type of the time zone structure (default is TimeZoneStruct). |
time_zone | The time zone structure containing hour and minute components. |
Definition at line 120 of file validation.mqh.
|
inlinenoexcept |
Check if the time zone is valid.
T | The type of the time zone components (default is int). |
hour | The hour component of the time zone. |
min | The minute component of the time zone. |
Definition at line 138 of file validation.hpp.
bool time_shield::is_valid_time_zone_offset | ( | const TimeZoneStruct & | time_zone | ) |
Check if the time zone structure is valid.
time_zone | Structure containing hour and minute components. |
Definition at line 114 of file validation.mqh.
bool time_shield::is_valid_tz | ( | const int | hour, |
const int | min ) |
Alias for is_valid_time_zone.
Check if the time zone is valid.
T | The type of the time zone components (default is int). |
hour | The hour component of the time zone. |
min | The minute component of the time zone. |
Definition at line 107 of file validation.mqh.
bool time_shield::is_valid_tz | ( | const TimeZoneStruct & | time_zone | ) |
Alias for is_valid_time_zone_offset.
Check if the time zone is valid.
T | The type of the time zone structure (default is TimeZoneStruct). |
time_zone | The time zone structure containing hour and minute components. |
Definition at line 126 of file validation.mqh.
|
inline |
Alias for is_valid_time_zone function.
Check if the time zone is valid.
T | The type of the time zone components (default is int). |
hour | The hour component of the time zone. |
min | The minute component of the time zone. |
Definition at line 149 of file validation.hpp.
bool time_shield::is_weekend | ( | const long | ts | ) |
Alias for is_day_off.
Check if a given timestamp corresponds to a weekend day (Saturday or Sunday).
This function checks if the given timestamp falls on a weekend day, which is either Saturday or Sunday.
ts | Timestamp to check (default: current timestamp). |
Definition at line 233 of file validation.mqh.
|
inlinenoexcept |
Alias for is_day_off function.
Check if a given timestamp corresponds to a weekend day (Saturday or Sunday).
This function checks if the given timestamp falls on a weekend day, which is either Saturday or Sunday.
ts | Timestamp to check (default: current timestamp). |
Definition at line 320 of file validation.hpp.
bool time_shield::is_weekend_unix_day | ( | const long | unix_day | ) |
Alias for is_day_off_unix_day.
Check if a given day (since Unix epoch) corresponds to a weekend day (Saturday or Sunday). This function checks if the given day (number of days since Unix epoch) falls on a weekend day, which is either Saturday or Sunday.
unix_day | Day to check (number of days since Unix epoch). |
Definition at line 245 of file validation.mqh.
|
inlinenoexcept |
Alias for is_day_off_unix_day function.
Check if a given day (since Unix epoch) corresponds to a weekend day (Saturday or Sunday). This function checks if the given day (number of days since Unix epoch) falls on a weekend day, which is either Saturday or Sunday.
unix_day | Day to check (number of days since Unix epoch). |
Definition at line 340 of file validation.hpp.
bool time_shield::leap_year | ( | const long | year | ) |
Alias for is_leap_year_date.
Checks if the given year is a leap year.
T | The type of the year (default is year_t). |
year | Year to check. |
Definition at line 47 of file validation.mqh.
|
constexprnoexcept |
Alias for is_leap_year_date function.
Checks if the given year is a leap year.
T | The type of the year (default is year_t). |
year | Year to check. |
Definition at line 68 of file validation.hpp.
bool time_shield::leap_year_ts | ( | const long | ts | ) |
Alias for is_leap_year_ts.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 83 of file validation.mqh.
TIME_SHIELD_CONSTEXPR bool time_shield::leap_year_ts | ( | ts_t | ts | ) |
Alias for is_leap_year_ts function.
Checks if the given year is a leap year.
This function determines whether the year corresponding to the provided timestamp is a leap year.
T | The type of the year parameter (default is year_t). |
ts | Timestamp in seconds since the Unix epoch. |
Definition at line 114 of file validation.hpp.