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 const bool | time_shield::is_leap_year_ts (ts_t ts) |
Checks if the given year is a leap year. | |
TIME_SHIELD_CONSTEXPR const bool | time_shield::leap_year_ts (ts_t ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR const bool | time_shield::check_leap_year_ts (ts_t ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR const bool | time_shield::is_leap_year (ts_t ts) |
Alias for is_leap_year_ts function. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR const 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 const 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 const 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 const 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 const 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 const 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. | |
A comprehensive set of functions for validating dates, times, leap years, 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.
|
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 60 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const 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 119 of file validation.hpp.
|
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 312 of file validation.hpp.
|
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 331 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const 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 125 of file validation.hpp.
|
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 53 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const 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 81 of file validation.hpp.
|
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 227 of file validation.hpp.
|
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 278 of file validation.hpp.
|
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 196 of file validation.hpp.
|
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 137 of file validation.hpp.
|
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 148 of file validation.hpp.
|
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 319 of file validation.hpp.
|
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 339 of file validation.hpp.
|
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 67 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const 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 113 of file validation.hpp.