Time Shield Library
C++ library for working with time
|
Main namespace for the Time Shield library. More...
Classes | |
struct | DateStruct |
Structure to represent a date. More... | |
struct | DateTimeStruct |
Structure to represent date and time. More... | |
struct | TimeStruct |
Structure to represent time. More... | |
struct | TimeZoneStruct |
Structure to represent time zone information. More... | |
Typedefs | |
typedef int64_t | year_t |
Integer year type. | |
typedef int64_t | uday_t |
Integer unix day type. | |
typedef int64_t | ts_t |
Integer timestamp type. | |
typedef int64_t | ts_ms_t |
Integer timestamp milliseconds type. | |
typedef int64_t | ts_us_t |
Integer timestamp microseconds type. | |
typedef double | fts_t |
Floating point timestamp type. | |
typedef double | oadate_t |
Automation date type (OADate) floating point. | |
typedef double | jd_t |
Julian Date type floating point. | |
typedef double | mjd_t |
Modified Julian Date type floating point. | |
typedef uint64_t | jdn_t |
Julian Day Number type. | |
typedef int | tz_t |
Enumerations | |
enum | FormatType { UPPERCASE_NAME = 0 , SHORT_NAME , FULL_NAME } |
Enumeration of the format options for representing a weekday or month. More... | |
enum | Weekday { SUN = 0 , MON , TUE , WED , THU , FRI , SAT } |
Enumeration of the days of the week. More... | |
enum | Month { JAN = 1 , FEB , MAR , APR , MAY , JUN , JUL , AUG , SEP , OCT , NOV , DEC } |
Enumeration of the months of the year. More... | |
enum | TimeZone { GMT , UTC , EET , CET , WET , EEST , CEST , WEST , UNKNOWN } |
Enumeration of the time zones. More... | |
enum | MoonPhase { WAXING_CRESCENT , FIRST_QUARTER , WAXING_GIBBOUS , FULL_MOON , WANING_GIBBOUS , LAST_QUARTER , WANING_CRESCENT , NEW_MOON } |
Enumeration of the moon phases. More... | |
enum | TimeFormatType { ISO8601_WITH_TZ , ISO8601_NO_TZ , MQL5_FULL , MQL5_DATE_ONLY , MQL5_TIME_ONLY , AMERICAN_MONTH_DAY , EUROPEAN_MONTH_DAY , AMERICAN_TIME , EUROPEAN_TIME } |
Enumeration of time format types. More... | |
Functions | |
const DateStruct | create_date_struct (const int64_t &year, const int &mon=1, const int &day=1) |
Creates a DateStruct instance. | |
const DateTimeStruct | create_date_time_struct (const int64_t &year, const int &mon=1, const int &day=1, const int &hour=0, const int &min=0, const int &sec=0, const int &ms=0) |
Creates a DateTimeStruct instance. | |
const char * | to_cstr (const Weekday &value, const FormatType &format=UPPERCASE_NAME) |
Converts a Weekday enum value to a string. | |
const std::string & | to_str (const Weekday &value, const FormatType &format=UPPERCASE_NAME) |
Converts a Weekday enum value to a string. | |
const char * | to_cstr (const Month &value, const FormatType &format=UPPERCASE_NAME) |
Converts a Month enum value to a string. | |
const std::string & | to_str (const Month &value, const FormatType &format=UPPERCASE_NAME) |
Converts a Month enum value to a string. | |
const char * | to_cstr (const TimeZone &value, const FormatType &format=UPPERCASE_NAME) |
Converts a TimeZone enum value to a string. | |
const std::string & | to_str (const TimeZone &value, const FormatType &format=UPPERCASE_NAME) |
Converts a TimeZone enum value to a string. | |
template<class T = int> | |
constexpr const T | ns_of_sec (const fts_t &ts) noexcept |
Get the nanosecond part of the second from a floating-point timestamp. | |
template<class T = int> | |
constexpr const T | us_of_sec (const fts_t &ts) noexcept |
Get the microsecond part of the second from a floating-point timestamp. | |
template<class T = int> | |
constexpr const T | ms_of_sec (const fts_t &ts) noexcept |
Get the millisecond part of the second from a floating-point timestamp. | |
template<class T = int> | |
constexpr const T | ms_of_ts (const ts_ms_t &ts) noexcept |
Get the millisecond part of the timestamp. | |
template<class T > | |
constexpr const ts_ms_t | sec_to_ms_impl (const T &t, std::true_type) noexcept |
template<class T > | |
constexpr const ts_ms_t | sec_to_ms_impl (const T &t, std::false_type) noexcept |
template<class T1 = ts_ms_t, class T2 > | |
constexpr const T1 | sec_to_ms (const T2 &ts) noexcept |
Converts a timestamp from seconds to milliseconds. | |
constexpr const ts_ms_t | fsec_to_ms (const fts_t &ts) noexcept |
Converts a floating-point timestamp from seconds to milliseconds. | |
template<class T1 = ts_t, class T2 = ts_ms_t> | |
constexpr const T1 | ms_to_sec (const T2 &ts_ms) noexcept |
Converts a timestamp from milliseconds to seconds. | |
template<class T = ts_ms_t> | |
constexpr const fts_t | ms_to_fsec (const T &ts_ms) noexcept |
Converts a timestamp from milliseconds to floating-point seconds. | |
template<class T = year_t> | |
constexpr const T | get_unix_year (const ts_t &ts) noexcept |
Converts a UNIX timestamp to a year. | |
template<class T = year_t> | |
constexpr const T | unix_year (const ts_t &ts) noexcept |
Alias for get_unix_year function. | |
template<class T = year_t> | |
constexpr const T | to_unix_year (const ts_t &ts) noexcept |
Alias for get_unix_year function. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR const T | hour24_to_12 (const T &hour) noexcept |
Converts a 24-hour format hour to a 12-hour format. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR const T | h24_to_h12 (const T &hour) noexcept |
Alias for hour24_to_12 function. | |
template<class T1 , class T2 = ts_t> | |
T1 | to_date_time (const T2 &ts) |
Converts a timestamp to a date-time structure. | |
template<class T1 , class T2 = ts_t> | |
T1 | to_dt (const T2 &ts) |
Alias for to_date_time function. | |
template<class T > | |
T | to_date_time_ms (const ts_ms_t &ts) |
Converts a timestamp in milliseconds to a date-time structure with milliseconds. | |
template<class T > | |
T | to_dt_ms (const ts_ms_t &ts) |
Alias for to_date_time_ms function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | to_timestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Converts a date and time to a timestamp. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | to_ts (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Alias for to_timestamp function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | get_ts (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Alias for to_timestamp function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | ts (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Alias for to_timestamp function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | timestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Alias for to_timestamp function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_t | get_timestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0) |
Alias for to_timestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | dt_to_timestamp (const T &date_time) |
Converts a date-time structure to a timestamp. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | to_timestamp (const T &date_time) |
Alias for dt_to_timestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | to_ts (const T &date_time) |
Alias for dt_to_timestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | ts (const T &date_time) |
Alias for dt_to_timestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | timestamp (const T &date_time) |
Alias for dt_to_timestamp function. | |
TIME_SHIELD_CONSTEXPR const ts_t | tm_to_timestamp (const std::tm *timeinfo) |
Converts a std::tm structure to a timestamp. | |
TIME_SHIELD_CONSTEXPR const ts_t | to_timestamp (const std::tm *timeinfo) |
Alias for tm_to_timestamp function. | |
TIME_SHIELD_CONSTEXPR const ts_t | to_ts (const std::tm *timeinfo) |
Alias for tm_to_timestamp function. | |
TIME_SHIELD_CONSTEXPR const ts_t | ts (const std::tm *timeinfo) |
Alias for tm_to_timestamp function. | |
TIME_SHIELD_CONSTEXPR const ts_t | timestamp (const std::tm *timeinfo) |
Alias for tm_to_timestamp function. | |
TIME_SHIELD_CONSTEXPR const ts_t | ts_from_tm (const std::tm *timeinfo) |
Alias for tm_to_timestamp function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | to_timestamp_ms (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T2 &ms=0) |
Converts a date and time to a timestamp in milliseconds. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | to_ts_ms (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T2 &ms=0) |
Alias for to_timestamp_ms function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | ts_ms (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T2 &ms=0) |
Alias for to_timestamp_ms function. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | timestamp_ms (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T2 &ms=0) |
Alias for to_timestamp_ms function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | dt_to_timestamp_ms (const T &date_time) |
Converts a date-time structure to a timestamp in milliseconds. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | to_timestamp_ms (const T &date_time) |
Alias for dt_to_timestamp_ms function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | to_ts_ms (const T &date_time) |
Alias for dt_to_timestamp_ms function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | ts_ms (const T &date_time) |
Alias for dt_to_timestamp_ms function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const ts_t | timestamp_ms (const T &date_time) |
Alias for dt_to_timestamp_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | tm_to_timestamp_ms (const std::tm *timeinfo) |
Converts a std::tm structure to a timestamp in milliseconds. | |
TIME_SHIELD_CONSTEXPR const ts_t | to_timestamp_ms (const std::tm *timeinfo) |
Alias for tm_to_timestamp_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | to_ts_ms (const std::tm *timeinfo) |
Alias for tm_to_timestamp_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | ts_ms (const std::tm *timeinfo) |
Alias for tm_to_timestamp_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | timestamp_ms (const std::tm *timeinfo) |
Alias for tm_to_timestamp_ms function. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const fts_t | to_ftimestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0) |
Converts a date and time to a floating-point timestamp. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const fts_t | to_fts (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0) |
Alias for to_ftimestamp function. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const fts_t | fts (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0) |
Alias for to_ftimestamp function. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const fts_t | ftimestamp (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0) |
Alias for to_ftimestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const fts_t | dt_to_ftimestamp (const T &date_time) |
Converts a date-time structure to a floating-point timestamp. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const fts_t | to_ftimestamp (const T &date_time) |
Alias for dt_to_ftimestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const fts_t | to_fts (const T &date_time) |
Alias for dt_to_ftimestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const fts_t | fts (const T &date_time) |
Alias for dt_to_ftimestamp function. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const fts_t | ftimestamp (const T &date_time) |
Alias for dt_to_ftimestamp function. | |
TIME_SHIELD_CONSTEXPR const fts_t | tm_to_ftimestamp (const std::tm *timeinfo) |
Converts a std::tm structure to a floating-point timestamp. | |
TIME_SHIELD_CONSTEXPR const fts_t | to_ftimestamp (const std::tm *timeinfo) |
Alias for tm_to_ftimestamp function. | |
TIME_SHIELD_CONSTEXPR const fts_t | to_fts (const std::tm *timeinfo) |
Alias for tm_to_ftimestamp function. | |
TIME_SHIELD_CONSTEXPR const fts_t | fts (const std::tm *timeinfo) |
Alias for tm_to_ftimestamp function. | |
TIME_SHIELD_CONSTEXPR const fts_t | ftimestamp (const std::tm *timeinfo) |
Alias for tm_to_ftimestamp function. | |
template<class T = uday_t> | |
constexpr const T | get_unix_day (const ts_t &ts=ts()) noexcept |
Get UNIX day. | |
template<class T = uday_t> | |
constexpr const T | unix_day (const ts_t &ts=ts()) noexcept |
Alias for get_unix_day function. | |
template<class T = uday_t> | |
constexpr const T | uday (const ts_t &ts=ts()) noexcept |
Alias for get_unix_day function. | |
template<class T = int> | |
constexpr const T | get_days_difference (const ts_t &start, const ts_t &stop) noexcept |
Get the number of days between two timestamps. | |
template<class T = int> | |
constexpr const T | get_days (const ts_t &start, const ts_t &stop) noexcept |
Alias for get_days_difference function. | |
template<class T = int> | |
constexpr const T | days (const ts_t &start, const ts_t &stop) noexcept |
Alias for get_days_difference function. | |
template<class T = uday_t> | |
constexpr const T | get_unix_day_ms (const ts_ms_t &t_ms=ts_ms()) noexcept |
Get UNIX day from milliseconds timestamp. | |
template<class T = uday_t> | |
constexpr const T | unix_day_ms (const ts_ms_t &t_ms=ts_ms()) noexcept |
Alias for get_unix_day_ms function. | |
template<class T = uday_t> | |
constexpr const T | uday_ms (const ts_ms_t &t_ms=ts_ms()) noexcept |
Alias for get_unix_day_ms function. | |
template<class T = ts_t> | |
constexpr const T | unix_day_to_timestamp (const uday_t &unix_day) noexcept |
Convert a UNIX day to a timestamp. | |
template<class T = ts_t> | |
constexpr const T | unix_day_to_ts (const uday_t &unix_day) noexcept |
Alias for unix_day_to_timestamp function. | |
template<class T = ts_t> | |
constexpr const T | uday_to_ts (const uday_t &unix_day) noexcept |
Alias for unix_day_to_timestamp function. | |
template<class T = int64_t> | |
constexpr const T | get_unix_min (const ts_t &ts=ts()) |
Get UNIX minute. | |
template<class T = int64_t> | |
constexpr const T | unix_min (const ts_t &ts=ts()) |
Alias for get_unix_min function. | |
template<class T = int64_t> | |
constexpr const T | to_unix_min (const ts_t &ts=ts()) |
Alias for get_unix_min function. | |
template<class T = int64_t> | |
constexpr const T | umin (const ts_t &ts=ts()) |
Alias for get_unix_min function. | |
template<class T = int> | |
constexpr const T | sec_of_day (const ts_t &ts=ts()) |
Get the second of the day. | |
template<class T = int> | |
constexpr const T | sec_of_day_ms (const ts_ms_t &ts_ms) noexcept |
Get the second of the day from milliseconds timestamp. | |
template<class T1 = int, class T2 = int> | |
constexpr const T1 | sec_of_day (const T2 &hour, const T2 &min, const T2 &sec) noexcept |
Get the second of the day. | |
template<class T = int> | |
constexpr const T | sec_of_min (const ts_t &ts=ts()) |
Get the second of the minute. | |
template<class T = int> | |
constexpr const T | sec_of_hour (const ts_t &ts=ts()) |
Get the second of the hour. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | get_year (const ts_t &ts=ts()) |
Get the year from the timestamp. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | year (const ts_t &ts=ts()) |
Alias for get_year function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | to_year (const ts_t &ts=ts()) |
Alias for get_year function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | get_year_ms (const ts_ms_t &ts_ms=ts_ms()) |
Get the year from the timestamp in milliseconds. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | year_ms (const ts_ms_t &ts_ms=ts_ms()) |
Alias for get_year_ms function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const T | to_year_ms (const ts_ms_t &ts_ms=ts_ms()) |
Alias for get_year_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | start_of_year (const ts_t &ts) noexcept |
Get the start of the year timestamp. | |
TIME_SHIELD_CONSTEXPR const ts_t | year_start (const ts_t &ts=ts()) |
Alias for start_of_year function. | |
TIME_SHIELD_CONSTEXPR const ts_t | year_begin (const ts_t &ts=ts()) |
Alias for start_of_year function. | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | start_of_year_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the start of the year timestamp in milliseconds. | |
TIME_SHIELD_CONSTEXPR const ts_t | year_start_ms (const ts_t &ts_ms=ts_ms()) |
Alias for start_of_year_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | year_begin_ms (const ts_t &ts_ms=ts_ms()) |
Alias for start_of_year_ms function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_t | start_of_year_date (const T &year) |
Get the timestamp of the start of the year. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_t | year_start_date (const T &year) |
Alias for start_of_year_date function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_t | year_begin_date (const T &year) |
Alias for start_of_year_date function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | start_of_year_date_ms (const T &year) |
Get the timestamp in milliseconds of the start of the year. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | year_start_date_ms (const T &year) |
Alias for start_of_year_date_ms function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | year_begin_date_ms (const T &year) |
Alias for start_of_year_date_ms function. | |
TIME_SHIELD_CONSTEXPR ts_t | end_of_year (const ts_t &ts=ts()) |
Get the end-of-year timestamp. | |
TIME_SHIELD_CONSTEXPR const ts_t | year_end (const ts_t &ts=ts()) |
Alias for end_of_year function. | |
template<class T = year_t> | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | end_of_year_ms (const ts_ms_t &ts_ms=ts_ms()) |
Get the timestamp in milliseconds of the end of the year. | |
TIME_SHIELD_CONSTEXPR const ts_ms_t | year_end_ms (const ts_ms_t &ts_ms=ts_ms()) |
Alias for end_of_year_ms function. | |
template<class T = int> | |
const T | day_of_year (const ts_t &ts=ts()) |
Get the day of the year. | |
template<class T = Month> | |
TIME_SHIELD_CONSTEXPR const T | month_of_year (const ts_t &ts) noexcept |
Get the month of the year. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR const T | day_of_month (const ts_t &ts) |
Get the day of the month. | |
template<class T1 = int, class T2 = year_t, class T3 = int> | |
constexpr const T1 | num_days_in_month (const T2 &year, const T3 &month) noexcept |
Get the number of days in a month. | |
template<class T1 = int, class T2 = year_t, class T3 = int> | |
constexpr const T1 | days_in_month (const T2 &year, const T3 &month) noexcept |
Alias for num_days_in_month function. | |
template<class T1 = int> | |
TIME_SHIELD_CONSTEXPR const T1 | num_days_in_month_ts (const ts_t &ts=ts()) noexcept |
Get the number of days in the month of the given timestamp. | |
template<class T1 = int> | |
constexpr const T1 | num_days_in_month (const ts_t &ts=ts()) noexcept |
Alias for num_days_in_month_ts function. | |
template<class T1 = int> | |
constexpr const T1 | days_in_month (const ts_t &ts=ts()) noexcept |
Alias for num_days_in_month_ts function. | |
template<class T1 = int, class T2 = year_t> | |
constexpr const T1 | num_days_in_year (const T2 &year) noexcept |
Get the number of days in a given year. | |
template<class T1 = int, class T2 = year_t> | |
constexpr const T1 | days_in_year (const T2 &year) noexcept |
Alias for num_days_in_year function. | |
template<class T = int> | |
constexpr const T | num_days_in_year_ts (const ts_t &ts=ts()) |
Get the number of days in the current year. | |
template<class T = int> | |
constexpr const T | days_in_year_ts (const ts_t &ts=ts()) |
Alias for num_days_in_year_ts function. | |
constexpr const ts_t | start_of_day (const ts_t &ts=ts()) noexcept |
Get the start of the day timestamp. | |
constexpr const ts_t | day_start (const ts_t &ts=ts()) noexcept |
Alias for start_of_day function. | |
template<class T = int> | |
constexpr const ts_t | start_of_prev_day (const ts_t &ts=ts(), const T &days=1) |
Get timestamp of the start of the previous day. | |
template<class T = int> | |
constexpr const ts_t | previous_day_start (const ts_t &ts=ts(), const T &days=1) |
Alias for start_of_prev_day function. | |
constexpr const ts_t | start_of_day_sec (const ts_ms_t &ts_ms=ts_ms()) |
Get the start of the day timestamp in seconds. | |
constexpr const ts_t | day_start_sec (const ts_ms_t &ts_ms=ts_ms()) |
Alias for start_of_day_sec function. | |
constexpr const ts_ms_t | start_of_day_ms (const ts_ms_t &ts_ms=ts_ms()) |
Get the start of the day timestamp in milliseconds. | |
constexpr const ts_ms_t | day_start_ms (const ts_ms_t &ts_ms=ts_ms()) |
Alias for start_of_day_ms function. | |
template<class T = int> | |
constexpr const ts_t | start_of_next_day (const ts_t &ts, const T &days=1) |
Get timestamp of the first day after a specified number of days. | |
template<class T = int> | |
constexpr const ts_t | next_day_start (const ts_t &ts, const T &days=1) |
Alias for start_of_next_day function. | |
constexpr const ts_t | end_of_day (const ts_t &ts=ts()) noexcept |
Get the timestamp at the end of the day. | |
constexpr const ts_t | day_end (const ts_t &ts=ts()) noexcept |
Alias for end_of_day function. | |
constexpr const ts_t | end_of_day_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the end of the day in seconds. | |
constexpr const ts_t | day_end_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for end_of_day_sec function. | |
constexpr const ts_ms_t | end_of_day_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the end of the day in milliseconds. | |
constexpr const ts_ms_t | day_end_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for end_of_day_ms function. | |
template<class T1 = Weekday, class T2 = year_t, class T3 = int> | |
constexpr const T1 | day_of_week_date (const T2 &year, const T3 &month, const T3 &day) |
Get the day of the week. | |
template<class T1 = Weekday, class T2 = year_t, class T3 = int> | |
constexpr const T1 | get_weekday (const T2 &year, const T3 &month, const T3 &day) |
Alias for day_of_week_date function. | |
template<class T1 = Weekday, class T2 = year_t, class T3 = int> | |
constexpr const T1 | day_of_week (const T2 &year, const T3 &month, const T3 &day) |
Alias for day_of_week_date function. | |
template<class T1 = Weekday, class T2 > | |
constexpr const T1 | get_weekday_from_date (const T2 &date) |
Get the day of the week from a date structure. | |
template<class T1 = int, class T2 > | |
constexpr const T1 | day_of_week_dt (const T2 &date) |
Alias for get_weekday_from_date function that accepts a date structure. | |
template<class T1 = int, class T2 > | |
constexpr const T1 | day_of_week (const T2 &date) |
Alias for get_weekday_from_date function that accepts a date structure. | |
template<class T = Weekday> | |
constexpr const T | get_weekday_from_ts (const ts_t &ts) noexcept |
Get the weekday from a timestamp. | |
template<class T = Weekday> | |
constexpr const T | day_of_week (const ts_t &ts) noexcept |
Alias for get_weekday_from_ts function. | |
template<class T = Weekday> | |
constexpr const T | get_weekday_from_ts_ms (const ts_ms_t &ts_ms) |
Get the weekday from a timestamp in milliseconds. | |
template<class T = Weekday> | |
constexpr const T | day_of_week_ms (const ts_ms_t &ts_ms) |
Alias for get_weekday_from_ts_ms function. | |
TIME_SHIELD_CONSTEXPR const ts_t | start_of_month (const ts_t &ts=ts()) |
Get the timestamp at the start of the current month. | |
TIME_SHIELD_CONSTEXPR const ts_t | month_begin (const ts_t &ts=ts()) |
Alias for start_of_month function. | |
TIME_SHIELD_CONSTEXPR const ts_t | end_of_month (const ts_t &ts=ts()) |
Get the last timestamp of the current month. | |
TIME_SHIELD_CONSTEXPR const ts_t | last_day_of_month (const ts_t &ts=ts()) |
Alias for end_of_month function. | |
TIME_SHIELD_CONSTEXPR const ts_t | last_sunday_of_month (const ts_t &ts=ts()) |
Get the timestamp of the last Sunday of the current month. | |
TIME_SHIELD_CONSTEXPR const ts_t | final_sunday_of_month (const ts_t &ts=ts()) |
Alias for last_sunday_of_month function. | |
template<class T1 = int, class T2 = year_t, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const T1 | last_sunday_month_day (const T2 &year, const T3 &month) |
Get the day of the last Sunday of the given month and year. | |
template<class T1 = int, class T2 = year_t, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const T1 | final_sunday_month_day (const T2 &year, const T3 &month) |
Alias for last_sunday_month_day function. | |
constexpr const ts_t | start_of_hour (const ts_t &ts=ts()) noexcept |
Get the timestamp at the start of the hour. | |
constexpr const ts_t | hour_begin (const ts_t &ts=ts()) noexcept |
Alias for start_of_hour function. | |
constexpr const ts_t | start_of_hour_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the start of the hour. | |
constexpr const ts_t | hour_begin_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for start_of_hour_sec function. | |
constexpr const ts_ms_t | start_of_hour_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the start of the hour. This function sets the minute and second to zero. | |
constexpr const ts_ms_t | hour_begin_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for start_of_hour_ms function. | |
constexpr const ts_t | end_of_hour (const ts_t &ts=ts()) noexcept |
Get the timestamp at the end of the hour. This function sets the minute and second to 59. | |
constexpr const ts_t | finish_of_hour (const ts_t &ts=ts()) noexcept |
Alias for end_of_hour function. | |
constexpr const ts_t | end_of_hour_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the end of the hour. | |
constexpr const ts_t | finish_of_hour_sec (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for end_of_hour_sec function. | |
constexpr const ts_ms_t | end_of_hour_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Get the timestamp at the end of the hour. | |
constexpr const ts_ms_t | finish_of_hour_ms (const ts_ms_t &ts_ms=ts_ms()) noexcept |
Alias for end_of_hour_ms function. | |
template<class T = int> | |
constexpr const T | hour_of_day (const ts_t &ts=ts()) noexcept |
Get the hour of the day. | |
template<class T = int> | |
constexpr const T | hour_in_day (const ts_t &ts=ts()) noexcept |
Alias for hour_of_day function. | |
constexpr const ts_t | start_of_week (const ts_t &ts=ts()) |
Get the timestamp of the beginning of the week. | |
constexpr const ts_t | week_begin (const ts_t &ts=ts()) |
Alias for start_of_week function. | |
constexpr const ts_t | end_of_week (const ts_t &ts=ts()) |
Get the timestamp of the end of the week. | |
constexpr const ts_t | finish_of_week (const ts_t &ts=ts()) |
Alias for end_of_week function. | |
constexpr const ts_t | start_of_saturday (const ts_t &ts=ts()) |
Get the timestamp of the start of Saturday. | |
constexpr const ts_t | saturday_begin (const ts_t &ts=ts()) |
Alias for start_of_saturday function. | |
constexpr const ts_t | start_of_min (const ts_t &ts=ts()) noexcept |
Get the timestamp of the beginning of the minute. | |
constexpr const ts_t | min_begin (const ts_t &ts=ts()) noexcept |
Alias for start_of_min function. | |
constexpr const ts_t | end_of_min (const ts_t &ts=ts()) noexcept |
Get the timestamp of the end of the minute. | |
constexpr const ts_t | finish_of_min (const ts_t &ts=ts()) noexcept |
Alias for end_of_min function. | |
template<class T = int> | |
constexpr const T | min_of_day (const ts_t &ts=ts()) noexcept |
Get minute of day. This function returns a value between 0 to 1439 (minute of day). | |
template<class T = int> | |
constexpr const T | min_of_hour (const ts_t &ts=ts()) noexcept |
Get minute of hour. This function returns a value between 0 to 59. | |
template<class T = int> | |
constexpr const ts_t | start_of_period (const T &p, const ts_t &ts=ts()) |
Get the timestamp of the start of the period. | |
template<class T = int> | |
constexpr const ts_t | end_of_period (const T &p, const ts_t &ts=ts()) |
Get the timestamp of the end of the period. | |
template<class T = TimeZoneStruct> | |
const TimeZoneStruct | to_time_zone (const tz_t &offset) |
Converts an integer to a time zone structure. | |
void | process_format_impl (const char &last_char, const size_t &repeat_count, const ts_t &ts, const tz_t &utc_offset, const DateTimeStruct &dt, std::string &result) |
template<class T = ts_t> | |
const std::string | to_string (const std::string &format_str, const T ×tamp, const tz_t &utc_offset=0) |
Convert timestamp to string with custom format. | |
template<class T = ts_t> | |
const std::string | to_str (const std::string &format_str, const T ×tamp, const tz_t &utc_offset=0) |
Alias for to_string function. | |
template<class T = ts_t> | |
const std::string | to_iso8601_str (const T &ts) |
Converts a timestamp to an ISO8601 string. | |
template<class T = ts_t> | |
const std::string | to_iso8601_date_str (const T &ts) |
Converts a timestamp to an ISO8601 date string. | |
template<class T = ts_t> | |
const std::string | to_iso8601_time_str (const T &ts) |
Converts a timestamp to an ISO8601 time string. | |
template<class T = ts_t> | |
const std::string | to_iso8601_time_utc_str (const T &ts) |
Converts a timestamp to an ISO8601 UTC time string. | |
template<class T = ts_t> | |
const std::string | to_iso8601_utc_str (const T &ts) |
Converts a timestamp to an ISO8601 string in UTC format. | |
const std::string | to_iso8601_utc_str_ms (const ts_ms_t &ts_ms) |
Converts a timestamp in milliseconds to an ISO8601 string in UTC format. | |
const std::string | to_iso8601_str_ms (const ts_ms_t &ts_ms) |
Converts a timestamp in milliseconds to an ISO8601 string. | |
template<class T = ts_t> | |
const std::string | to_iso8601_str (const T &ts, const tz_t &utc_offset) |
Converts a timestamp to an ISO8601 string with timezone offset. | |
const std::string | to_iso8601_str_ms (const ts_ms_t &ts_ms, const tz_t &utc_offset) |
Converts a timestamp in milliseconds to an ISO8601 string with timezone offset. | |
const std::string | to_mql5_date_time_str (const ts_t &ts) |
Converts a timestamp to a string in MQL5 date and time format. | |
const std::string | to_mql5_full_str (const ts_t &ts) |
Alias for to_mql5_date_time_str function. | |
const std::string | to_mql5_date_str (const ts_t &ts) |
Converts a timestamp to a string in MQL5 date format. | |
const std::string | to_mql5_time_str (const ts_t &ts) |
Converts a timestamp to a string in MQL5 time format. | |
template<class T = Month> | |
const T | get_month_number (const std::string &month) |
Get the month number by name. | |
template<class T = Month> | |
const T | month_of_year (const std::string &month) |
Alias for get_month_number function. | |
template<class T = Month> | |
const bool | try_get_month_number (const std::string &month, T &value) |
Get the month number by name, with output parameter. | |
template<class T = Month> | |
const bool | get_month_number (const std::string &month, T &value) |
Alias for try_get_month_number function. | |
template<class T = Month> | |
const bool | month_of_year (const std::string &month, T &value) |
Alias for try_get_month_number function. | |
const bool | parse_time_zone (const std::string &tz_str, TimeZoneStruct &tz) |
Parse a time zone string into a TimeZoneStruct. | |
const bool | parse_tz (const std::string &tz_str, TimeZoneStruct &tz) |
Alias for parse_time_zone function. | |
const bool | parse_iso8601 (const std::string &input, DateTimeStruct &dt, TimeZoneStruct &tz) |
Parse a date and time string in ISO8601 format. | |
const bool | str_to_ts (const std::string &str, ts_t &ts) |
Convert an ISO8601 string to a timestamp (ts_t). | |
const bool | str_to_ts_ms (const std::string &str, ts_ms_t &ts) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
const bool | str_to_fts (const std::string &str, fts_t &ts) |
Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
const ts_t | ts (const std::string &str) |
Convert an ISO8601 string to a timestamp (ts_t). | |
const ts_ms_t | ts_ms (const std::string &str) |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t). | |
const fts_t | fts (const std::string &str) |
Convert an ISO8601 string to a floating-point timestamp (fts_t). | |
const ts_t | ts (const char *str) |
Convert an ISO8601 C-style string to a timestamp (ts_t). | |
const ts_ms_t | ts_ms (const char *str) |
Convert an ISO8601 C-style string to a millisecond timestamp (ts_ms_t). | |
const fts_t | fts (const char *str) |
Convert an ISO8601 C-style string to a floating-point timestamp (fts_t). | |
const TimeStruct | create_time_struct (const int &hour, const int &min, const int &sec=0, const int &ms=0) |
Creates a TimeStruct instance. | |
const struct timespec | get_timespec_impl () noexcept |
Get the current timespec. | |
template<class T = int> | |
const T | ns_of_sec () noexcept |
Get the nanosecond part of the current second. | |
template<class T = int> | |
const T | us_of_sec () noexcept |
Get the microsecond part of the current second. | |
template<class T = int> | |
const T | ms_of_sec () noexcept |
Get the millisecond part of the current second. | |
const ts_t | ts () noexcept |
Get the current UTC timestamp in seconds. | |
const ts_t | timestamp () noexcept |
Get the current UTC timestamp in seconds. | |
const fts_t | fts () noexcept |
Get the current UTC timestamp in floating-point seconds. | |
const fts_t | ftimestamp () noexcept |
Get the current UTC timestamp in floating-point seconds. | |
const ts_ms_t | ts_ms () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_ms_t | timestamp_ms () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_ms_t | now () noexcept |
Get the current UTC timestamp in milliseconds. | |
const ts_us_t | ts_us () noexcept |
Get the current UTC timestamp in microseconds. | |
const ts_us_t | timestamp_us () noexcept |
Get the current UTC timestamp in microseconds. | |
const TimeZoneStruct | create_time_zone_struct (const int &hour, const int &min, const bool &is_positive=true) |
Creates a TimeZoneStruct instance. | |
const TimeZoneStruct | to_time_zone_struct (const tz_t &offset) |
Converts an integer to a TimeZoneStruct. | |
const TimeZoneStruct | to_tz (const tz_t &offset) |
Alias for to_time_zone_struct function. | |
const std::string | time_zone_struct_to_string (const TimeZoneStruct &tz) |
Converts a TimeZoneStruct to a string representation. | |
const std::string | to_string (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_string function. | |
const std::string | to_str (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_string function. | |
const tz_t | time_zone_struct_to_offset (const TimeZoneStruct &tz) |
Converts a TimeZoneStruct to a single integer representation. | |
const tz_t | tz_to_offset (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_offset function. | |
const tz_t | to_offset (const TimeZoneStruct &tz) |
Alias for time_zone_struct_to_offset function. | |
template<class T = year_t> | |
constexpr const bool | is_leap_year_date (const T &year) noexcept |
Checks if the given year is a leap year. | |
template<class T = year_t> | |
constexpr const bool | check_leap_year (const T &year) noexcept |
Alias for is_leap_year_date function. | |
template<class T = year_t> | |
constexpr const bool | leap_year (const T &year) noexcept |
Alias for is_leap_year_date function. | |
TIME_SHIELD_CONSTEXPR const bool | is_leap_year_ts (const ts_t &ts) |
Checks if the given year is a leap year. | |
TIME_SHIELD_CONSTEXPR const bool | leap_year_ts (const ts_t &ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR const bool | check_leap_year_ts (const ts_t &ts) |
Alias for is_leap_year_ts function. | |
TIME_SHIELD_CONSTEXPR const bool | is_leap_year (const ts_t &ts) |
Alias for is_leap_year_ts function. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_time_zone (const T &hour, const T &min) noexcept |
Check if the time zone is valid. | |
template<class T = int> | |
TIME_SHIELD_CONSTEXPR bool | is_valid_tz (const T &hour, const T &min) |
Alias for is_valid_time_zone function. | |
template<class T = TimeZoneStruct> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_time_zone_offset (const T &time_zone) noexcept |
Check if the time zone is valid. | |
template<class T = TimeZoneStruct> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_time_zone (const T &time_zone) |
Alias for is_valid_time_zone_offset function. | |
template<class T = TimeZoneStruct> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_tz (const T &time_zone) |
Alias for is_valid_time_zone_offset function. | |
template<class T1 = int, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_time (const T1 &hour, const T1 &min, const T1 &sec, const T2 &ms=0) noexcept |
Checks the correctness of the specified time. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_time (const T &time) noexcept |
Checks the correctness of the specified time. | |
template<class T1 = year_t, class T2 = int> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_date (const T1 &year, const T2 &month, const T2 &day) noexcept |
Checks the correctness of the specified date. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_date (const T &date) noexcept |
Checks the correctness of the specified date. | |
template<class T1 = year_t, class T2 = int, class T3 = int> | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_date_time (const T1 &year, const T2 &month, const T2 &day, const T2 &hour=0, const T2 &min=0, const T2 &sec=0, const T3 &ms=0) noexcept |
Checks the correctness of a date and time. | |
template<class T > | |
TIME_SHIELD_CONSTEXPR const bool | is_valid_date_time (const T &date_time) noexcept |
Checks the correctness of a date and time. | |
TIME_SHIELD_CONSTEXPR const bool | is_day_off (const ts_t &ts) noexcept |
Check if a given timestamp corresponds to a weekend day (Saturday or Sunday). | |
TIME_SHIELD_CONSTEXPR const bool | is_weekend (const ts_t &ts) noexcept |
Alias for is_day_off function. | |
template<class T = uday_t> | |
TIME_SHIELD_CONSTEXPR bool | is_day_off_unix_day (const 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 | is_weekend_unix_day (const T &unix_day) noexcept |
Alias for is_day_off_unix_day function. | |
Variables | |
constexpr int64_t | NS_PER_US = 1000 |
Nanoseconds per microsecond. | |
constexpr int64_t | NS_PER_MS = 1000000 |
Nanoseconds per millisecond. | |
constexpr int64_t | NS_PER_SEC = 1000000000 |
Nanoseconds per second. | |
constexpr int64_t | US_PER_SEC = 1000000 |
Microseconds per second. | |
constexpr int64_t | MS_PER_SEC = 1000 |
Milliseconds per second. | |
constexpr int64_t | MS_PER_MIN = 60000 |
Milliseconds per minute. | |
constexpr int64_t | MS_PER_HALF_HOUR = 1800000 |
Milliseconds per half hour. | |
constexpr int64_t | MS_PER_HOUR = 3600000 |
Milliseconds per hour. | |
constexpr int64_t | MS_PER_DAY = 86400000 |
Milliseconds per day. | |
constexpr int64_t | SEC_PER_MIN = 60 |
Seconds per minute. | |
constexpr int64_t | SEC_PER_HALF_HOUR = 1800 |
Seconds per half hour. | |
constexpr int64_t | SEC_PER_HOUR = 3600 |
Seconds per hour. | |
constexpr int64_t | SEC_PER_DAY = 86400 |
Seconds per day. | |
constexpr int64_t | SEC_PER_YEAR = 31536000 |
Seconds per year (365 days) | |
constexpr int64_t | AVG_SEC_PER_YEAR = 31557600 |
Average seconds per year (365.25 days) | |
constexpr int64_t | SEC_PER_LEAP_YEAR = 31622400 |
Seconds per leap year (366 days) | |
constexpr int64_t | SEC_PER_4_YEARS = 126230400 |
Seconds per 4 years. | |
constexpr int64_t | SEC_PER_FIRST_100_YEARS = 3155760000 |
Seconds per first 100 years. | |
constexpr int64_t | SEC_PER_100_YEARS = 3155673600 |
Seconds per 100 years. | |
constexpr int64_t | SEC_PER_400_YEARS = 12622780800 |
Seconds per 400 years. | |
constexpr int64_t | MAX_SEC_PER_DAY = 86399 |
Maximum seconds per day. | |
constexpr int64_t | MIN_PER_HOUR = 60 |
Minutes per hour. | |
constexpr int64_t | MIN_PER_DAY = 1440 |
Minutes per day. | |
constexpr int64_t | MIN_PER_WEEK = 10080 |
Minutes per week. | |
constexpr int64_t | MIN_PER_MONTH = 40320 |
Minutes per month (28 days) | |
constexpr int64_t | MAX_MOON_MIN = 42523 |
Maximum lunar minutes. | |
constexpr int64_t | HOURS_PER_DAY = 24 |
Hours per day. | |
constexpr int64_t | DAYS_PER_WEEK = 7 |
Days per week. | |
constexpr int64_t | DAYS_PER_LEAP_YEAR = 366 |
Days per leap year. | |
constexpr int64_t | DAYS_PER_YEAR = 365 |
Days per year. | |
constexpr int64_t | DAYS_PER_4_YEARS = 1461 |
Days per 4 years. | |
const int64_t | MONTHS_PER_YEAR = 12 |
Months per year. | |
const int64_t | MAX_DAYS_PER_MONTH = 31 |
Maximum days per month. | |
const int64_t | LEAP_YEAR_PER_100_YEAR = 24 |
Leap years per 100 years. | |
const int64_t | LEAP_YEAR_PER_400_YEAR = 97 |
Leap years per 400 years. | |
constexpr int64_t | UNIX_EPOCH = 1970 |
Start year of UNIX time. | |
constexpr int64_t | OLE_EPOCH = 25569 |
OLE automation date since UNIX epoch. | |
constexpr int64_t | MAX_YEAR = 292277022000LL |
Maximum representable year. | |
constexpr int64_t | MIN_YEAR = -2967369602200LL |
Minimum representable year. | |
constexpr int64_t | ERROR_YEAR = 9223372036854770000LL |
Error year value. | |
constexpr int64_t | MAX_TIMESTAMP = 9223371890843040000LL |
Maximum timestamp value. | |
constexpr int64_t | ERROR_TIMESTAMP = 9223372036854770000LL |
Error timestamp value. | |
constexpr double | MAX_OADATE = std::numeric_limits<double>::max() |
Maximum OLE automation date. | |
constexpr double | AVG_DAYS_PER_YEAR = 365.25 |
Average days per year. | |
Main namespace for the Time Shield library.
The time_shield namespace contains all the core components and functions of the Time Shield library. It includes various utilities for working with time and dates, their formatting, conversion, and validation.
typedef double time_shield::fts_t |
typedef double time_shield::jd_t |
typedef uint64_t time_shield::jdn_t |
typedef double time_shield::mjd_t |
typedef double time_shield::oadate_t |
typedef int64_t time_shield::ts_ms_t |
typedef int64_t time_shield::ts_t |
typedef int64_t time_shield::ts_us_t |
typedef int time_shield::tz_t |
typedef int64_t time_shield::uday_t |
typedef int64_t time_shield::year_t |
enum time_shield::Month |
Enumeration of time format types.
Enumeration of the time zones.
enum time_shield::Weekday |
|
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 27 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const bool time_shield::check_leap_year_ts | ( | const 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 86 of file validation.hpp.
|
inline |
Creates a DateStruct instance.
year | The year component of the date. |
mon | The month component of the date, defaults to 1 (January). |
day | The day component of the date, defaults to 1. |
Definition at line 23 of file date_struct.hpp.
|
inline |
Creates a DateTimeStruct instance.
year | The year component of the date. |
mon | The month component of the date, defaults to 1 (January). |
day | The day component of the date, defaults to 1. |
hour | The hour component of the time, defaults to 0. |
min | The minute component of the time, defaults to 0. |
sec | The second component of the time, defaults to 0. |
ms | The millisecond component of the time, defaults to 0. |
Definition at line 31 of file date_time_struct.hpp.
|
inline |
Creates a TimeStruct instance.
hour | The hour component of the time. |
min | The minute component of the time. |
sec | The second component of the time, defaults to 0. |
ms | The millisecond component of the time, defaults to 0. |
Definition at line 25 of file time_struct.hpp.
|
inline |
Creates a TimeZoneStruct instance.
hour | The hour component of the time. |
min | The minute component of the time. |
is_positive | True if the time zone offset is positive, false if negative. |
Definition at line 27 of file time_zone_struct.hpp.
Alias for end_of_day function.
Get the timestamp at the end of the day.
This function sets the hour to 23, minute to 59, and second to 59.
ts | Timestamp. |
Definition at line 1731 of file time_conversions.hpp.
Alias for end_of_day_ms function.
Get the timestamp at the end of the day in milliseconds.
This function sets the hour to 23, minute to 59, second to 59, and millisecond to 999.
ts_ms | Timestamp in milliseconds. |
Definition at line 1767 of file time_conversions.hpp.
Alias for end_of_day_sec function.
Get the timestamp at the end of the day in seconds.
This function sets the hour to 23, minute to 59, and second to 59.
ts_ms | Timestamp in milliseconds. |
Definition at line 1749 of file time_conversions.hpp.
|
inline |
Get the day of the month.
This function returns the day of the month for the specified timestamp.
ts | Timestamp. |
Definition at line 1491 of file time_conversions.hpp.
|
constexpr |
Alias for get_weekday_from_date function that accepts a date structure.
Get the day of the week from a date structure.
This function takes a date structure with fields 'year', 'mon', and 'day', and returns the day of the week (SUN = 0, MON = 1, ... SAT = 6).
date | Structure containing year, month, and day. |
Definition at line 1826 of file time_conversions.hpp.
|
constexpr |
Alias for day_of_week_date function.
Get the day of the week.
year | Year. |
month | Month of the year. |
day | Day of the month. |
Definition at line 1798 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_weekday_from_ts function.
Get the weekday from a timestamp.
ts | Timestamp. |
Definition at line 1843 of file time_conversions.hpp.
|
constexpr |
Get the day of the week.
year | Year. |
month | Month of the year. |
day | Day of the month. |
Definition at line 1779 of file time_conversions.hpp.
|
constexpr |
Alias for get_weekday_from_date function that accepts a date structure.
Get the day of the week from a date structure.
This function takes a date structure with fields 'year', 'mon', and 'day', and returns the day of the week (SUN = 0, MON = 1, ... SAT = 6).
date | Structure containing year, month, and day. |
Definition at line 1819 of file time_conversions.hpp.
|
constexpr |
Alias for get_weekday_from_ts_ms function.
Get the weekday from a timestamp in milliseconds.
ts_ms | Timestamp in milliseconds. |
Definition at line 1860 of file time_conversions.hpp.
Get the day of the year.
This function returns the day of the year for the specified timestamp.
ts | Timestamp. |
Definition at line 1448 of file time_conversions.hpp.
Alias for start_of_day function.
Get the start of the day timestamp.
This function returns the timestamp at the start of the day. The function sets the hours, minutes, and seconds to zero.
ts | Timestamp. |
Definition at line 1633 of file time_conversions.hpp.
Alias for start_of_day_ms function.
Get the start of the day timestamp in milliseconds.
This function returns the timestamp at the start of the day in milliseconds. The function sets the hours, minutes, seconds, and milliseconds to zero.
ts_ms | Timestamp in milliseconds. |
Definition at line 1692 of file time_conversions.hpp.
Alias for start_of_day_sec function.
Get the start of the day timestamp in seconds.
This function returns the timestamp at the start of the day in seconds. The function sets the hours, minutes, and seconds to zero.
ts_ms | Timestamp in milliseconds. |
Definition at line 1673 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_days_difference function.
Get the number of days between two timestamps.
This function calculates the number of days between two timestamps.
T | The type of the return value, defaults to int. |
start | The timestamp of the start of the period. |
stop | The timestamp of the end of the period. |
Definition at line 958 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for num_days_in_month function.
Get the number of days in a month.
This function calculates and returns the number of days in the specified month and year.
year | Year as an integer. |
month | Month as an integer. |
Definition at line 1540 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for num_days_in_month_ts function.
Get the number of days in the month of the given timestamp.
This function calculates and returns the number of days in the month of the specified timestamp.
ts | The timestamp to extract month and year from. |
Definition at line 1572 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for num_days_in_year function.
Get the number of days in a given year.
This function calculates and returns the number of days in the specified year.
year | Year. |
Definition at line 1593 of file time_conversions.hpp.
Alias for num_days_in_year_ts function.
Get the number of days in the current year.
This function calculates and returns the number of days in the current year based on the provided timestamp.
ts | Timestamp. |
Definition at line 1614 of file time_conversions.hpp.
|
inline |
Converts a date-time structure to a floating-point timestamp.
This function converts a given date and time structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure containing year, month, day, hour, minute, second, and millisecond fields. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 823 of file time_conversions.hpp.
|
inline |
Converts a date-time structure to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 473 of file time_conversions.hpp.
|
inline |
Converts a date-time structure to a timestamp in milliseconds.
This function converts a given date-time structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 656 of file time_conversions.hpp.
Get the timestamp at the end of the day.
This function sets the hour to 23, minute to 59, and second to 59.
ts | Timestamp. |
Definition at line 1725 of file time_conversions.hpp.
Get the timestamp at the end of the day in milliseconds.
This function sets the hour to 23, minute to 59, second to 59, and millisecond to 999.
ts_ms | Timestamp in milliseconds. |
Definition at line 1761 of file time_conversions.hpp.
Get the timestamp at the end of the day in seconds.
This function sets the hour to 23, minute to 59, and second to 59.
ts_ms | Timestamp in milliseconds. |
Definition at line 1743 of file time_conversions.hpp.
Get the timestamp at the end of the hour. This function sets the minute and second to 59.
ts | Timestamp (default: current timestamp). |
Definition at line 2001 of file time_conversions.hpp.
Get the timestamp at the end of the hour.
This function sets the minute and second to 59.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 2037 of file time_conversions.hpp.
Get the timestamp at the end of the hour.
This function sets the minute and second to 59.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 2019 of file time_conversions.hpp.
Get the timestamp of the end of the minute.
ts | Timestamp (default: current timestamp). |
Definition at line 2144 of file time_conversions.hpp.
|
inline |
Get the last timestamp of the current month.
This function returns the last timestamp of the current month, setting the day to the last day of the month and the time to 23:59:59.
ts | Timestamp (default is current timestamp) |
Definition at line 1892 of file time_conversions.hpp.
|
constexpr |
Get the timestamp of the end of the period.
p | Period duration in seconds. |
ts | Timestamp (default: current timestamp). |
Definition at line 2194 of file time_conversions.hpp.
Get the timestamp of the end of the week.
This function finds the timestamp of the end of the week, which corresponds to the end of Saturday.
ts | Timestamp (default: current timestamp). |
Definition at line 2095 of file time_conversions.hpp.
|
inline |
Get the end-of-year timestamp.
This function finds the last timestamp of the current year.
ts | Timestamp. |
Definition at line 1355 of file time_conversions.hpp.
|
inline |
Get the timestamp in milliseconds of the end of the year.
This function finds the last timestamp of the current year in milliseconds.
ts_ms | Timestamp in milliseconds. |
Definition at line 1429 of file time_conversions.hpp.
|
inline |
Alias for last_sunday_month_day function.
Get the day of the last Sunday of the given month and year.
This function returns the day of the last Sunday of the specified month and year.
year | Year |
month | Month (1 = January, 12 = December) |
Definition at line 1939 of file time_conversions.hpp.
|
inline |
Alias for last_sunday_of_month function.
Get the timestamp of the last Sunday of the current month.
This function returns the timestamp of the last Sunday of the current month, setting the day to the last Sunday and the time to 00:00:00.
ts | Timestamp (default is current timestamp) |
Definition at line 1917 of file time_conversions.hpp.
Alias for end_of_hour function.
Get the timestamp at the end of the hour. This function sets the minute and second to 59.
ts | Timestamp (default: current timestamp). |
Definition at line 2007 of file time_conversions.hpp.
Alias for end_of_hour_ms function.
Get the timestamp at the end of the hour.
This function sets the minute and second to 59.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 2043 of file time_conversions.hpp.
Alias for end_of_hour_sec function.
Get the timestamp at the end of the hour.
This function sets the minute and second to 59.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 2025 of file time_conversions.hpp.
Alias for end_of_min function.
Get the timestamp of the end of the minute.
ts | Timestamp (default: current timestamp). |
Definition at line 2150 of file time_conversions.hpp.
Alias for end_of_week function.
Get the timestamp of the end of the week.
This function finds the timestamp of the end of the week, which corresponds to the end of Saturday.
ts | Timestamp (default: current timestamp). |
Definition at line 2101 of file time_conversions.hpp.
Converts a floating-point timestamp from seconds to milliseconds.
ts | Timestamp in floating-point seconds. |
Definition at line 94 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in floating-point seconds.
Definition at line 77 of file time_utils.hpp.
|
inline |
Alias for tm_to_ftimestamp function.
Converts a std::tm structure to a floating-point timestamp.
This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
timeinfo | Pointer to the std::tm structure containing the date and time. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 900 of file time_conversions.hpp.
|
inline |
Alias for dt_to_ftimestamp function.
Converts a date-time structure to a floating-point timestamp.
This function converts a given date and time structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure containing year, month, day, hour, minute, second, and millisecond fields. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 856 of file time_conversions.hpp.
|
inline |
Alias for to_ftimestamp function.
Converts a date and time to a floating-point timestamp.
This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is year_t). |
T2 | The type of the month, day, hour, minute, and second parameters (default is int). |
T3 | The type of the millisecond parameter (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 799 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in floating-point seconds.
Definition at line 70 of file time_utils.hpp.
|
inline |
Convert an ISO8601 C-style string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp. If the parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 303 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp. If the parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 269 of file time_parser.hpp.
|
inline |
Alias for tm_to_ftimestamp function.
Converts a std::tm structure to a floating-point timestamp.
This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
timeinfo | Pointer to the std::tm structure containing the date and time. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 893 of file time_conversions.hpp.
|
inline |
Alias for dt_to_ftimestamp function.
Converts a date-time structure to a floating-point timestamp.
This function converts a given date and time structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure containing year, month, day, hour, minute, second, and millisecond fields. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 848 of file time_conversions.hpp.
|
inline |
Alias for to_ftimestamp function.
Converts a date and time to a floating-point timestamp.
This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is year_t). |
T2 | The type of the month, day, hour, minute, and second parameters (default is int). |
T3 | The type of the millisecond parameter (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 785 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_days_difference function.
Get the number of days between two timestamps.
This function calculates the number of days between two timestamps.
T | The type of the return value, defaults to int. |
start | The timestamp of the start of the period. |
stop | The timestamp of the end of the period. |
Definition at line 951 of file time_conversions.hpp.
|
constexprnoexcept |
Get the number of days between two timestamps.
This function calculates the number of days between two timestamps.
T | The type of the return value, defaults to int. |
start | The timestamp of the start of the period. |
stop | The timestamp of the end of the period. |
Definition at line 944 of file time_conversions.hpp.
const T time_shield::get_month_number | ( | const std::string & | month | ) |
Get the month number by name.
T | The return type, default is Month enum. |
month | The name of the month as a string. |
std::invalid_argument | if the month name is invalid. |
Definition at line 30 of file time_parser.hpp.
const bool time_shield::get_month_number | ( | const std::string & | month, |
T & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 101 of file time_parser.hpp.
|
inlinenoexcept |
Get the current timespec.
Definition at line 16 of file time_utils.hpp.
|
inline |
Alias for to_timestamp function.
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 451 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp function.
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 412 of file time_conversions.hpp.
|
constexprnoexcept |
Get UNIX day.
This function returns the number of days elapsed since the UNIX epoch.
T | The return type of the function (default is unix_day_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 915 of file time_conversions.hpp.
|
constexprnoexcept |
Get UNIX day from milliseconds timestamp.
This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.
T | The return type of the function (default is unix_day_t). |
t_ms | Timestamp in milliseconds (default is current timestamp in milliseconds). |
Definition at line 972 of file time_conversions.hpp.
Get UNIX minute.
This function returns the number of minutes elapsed since the UNIX epoch.
T | The return type of the function (default is int64_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1028 of file time_conversions.hpp.
|
constexprnoexcept |
Converts a UNIX timestamp to a year.
T | The type of the year (default is year_t). |
ts | UNIX timestamp. |
Definition at line 124 of file time_conversions.hpp.
|
constexpr |
Alias for day_of_week_date function.
Get the day of the week.
year | Year. |
month | Month of the year. |
day | Day of the month. |
Definition at line 1791 of file time_conversions.hpp.
|
constexpr |
Get the day of the week from a date structure.
This function takes a date structure with fields 'year', 'mon', and 'day', and returns the day of the week (SUN = 0, MON = 1, ... SAT = 6).
date | Structure containing year, month, and day. |
Definition at line 1812 of file time_conversions.hpp.
|
constexprnoexcept |
Get the weekday from a timestamp.
ts | Timestamp. |
Definition at line 1836 of file time_conversions.hpp.
|
constexpr |
Get the weekday from a timestamp in milliseconds.
ts_ms | Timestamp in milliseconds. |
Definition at line 1853 of file time_conversions.hpp.
|
inline |
Get the year from the timestamp.
This function returns the year of the specified timestamp in seconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1131 of file time_conversions.hpp.
|
inline |
Get the year from the timestamp in milliseconds.
This function returns the year of the specified timestamp in milliseconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts_ms | Timestamp in milliseconds (default is current timestamp). |
Definition at line 1159 of file time_conversions.hpp.
|
inlinenoexcept |
Alias for hour24_to_12 function.
Converts a 24-hour format hour to a 12-hour format.
T | Numeric type of the hour (default is int). |
hour | The hour in 24-hour format to convert. |
Definition at line 183 of file time_conversions.hpp.
|
inlinenoexcept |
Converts a 24-hour format hour to a 12-hour format.
T | Numeric type of the hour (default is int). |
hour | The hour in 24-hour format to convert. |
Definition at line 175 of file time_conversions.hpp.
Alias for start_of_hour function.
Get the timestamp at the start of the hour.
This function sets the minute and second to zero.
ts | Timestamp (default: current timestamp). |
Definition at line 1957 of file time_conversions.hpp.
Alias for start_of_hour_ms function.
Get the timestamp at the start of the hour. This function sets the minute and second to zero.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 1991 of file time_conversions.hpp.
Alias for start_of_hour_sec function.
Get the timestamp at the start of the hour.
This function sets the minute and second to zero.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 1975 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for hour_of_day function.
Get the hour of the day.
This function returns a value between 0 to 23 representing the hour of the day.
ts | Timestamp (default: current timestamp). |
Definition at line 2063 of file time_conversions.hpp.
|
constexprnoexcept |
Get the hour of the day.
This function returns a value between 0 to 23 representing the hour of the day.
ts | Timestamp (default: current timestamp). |
Definition at line 2056 of file time_conversions.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 273 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 292 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const bool time_shield::is_leap_year | ( | const 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 92 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 20 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const bool time_shield::is_leap_year_ts | ( | const 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 48 of file validation.hpp.
|
inlinenoexcept |
Checks the correctness of the specified date.
T | The type of the date-time structure. |
date | Date-time structure. |
Definition at line 223 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 190 of file validation.hpp.
|
inlinenoexcept |
Checks the correctness of a date and time.
T | The type of the date-time structure. |
date_time | Date-time structure. |
Definition at line 258 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 240 of file validation.hpp.
|
inlinenoexcept |
Checks the correctness of the specified time.
T | The type of the time structure. |
time | Time structure. |
Definition at line 177 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 160 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 104 of file validation.hpp.
|
inline |
Alias for is_valid_time_zone_offset function.
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 136 of file validation.hpp.
|
inlinenoexcept |
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 128 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 115 of file validation.hpp.
|
inline |
Alias for is_valid_time_zone_offset function.
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 144 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 280 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 300 of file validation.hpp.
|
inline |
Alias for end_of_month function.
Get the last timestamp of the current month.
This function returns the last timestamp of the current month, setting the day to the last day of the month and the time to 23:59:59.
ts | Timestamp (default is current timestamp) |
Definition at line 1898 of file time_conversions.hpp.
|
inline |
Get the day of the last Sunday of the given month and year.
This function returns the day of the last Sunday of the specified month and year.
year | Year |
month | Month (1 = January, 12 = December) |
Definition at line 1931 of file time_conversions.hpp.
|
inline |
Get the timestamp of the last Sunday of the current month.
This function returns the timestamp of the last Sunday of the current month, setting the day to the last Sunday and the time to 00:00:00.
ts | Timestamp (default is current timestamp) |
Definition at line 1911 of file time_conversions.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 34 of file validation.hpp.
TIME_SHIELD_CONSTEXPR const bool time_shield::leap_year_ts | ( | const 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 80 of file validation.hpp.
Alias for start_of_min function.
Get the timestamp of the beginning of the minute.
ts | Timestamp (default: current timestamp). |
Definition at line 2135 of file time_conversions.hpp.
Get minute of day. This function returns a value between 0 to 1439 (minute of day).
ts | Timestamp in seconds (default: current timestamp). |
Definition at line 2161 of file time_conversions.hpp.
|
constexprnoexcept |
Get minute of hour. This function returns a value between 0 to 59.
ts | Timestamp in seconds (default: current timestamp). |
Definition at line 2172 of file time_conversions.hpp.
|
inline |
Alias for start_of_month function.
Get the timestamp at the start of the current month.
This function returns the timestamp at the start of the current month, setting the day to the first day of the month and the time to 00:00:00.
ts | Timestamp (default is current timestamp) |
Definition at line 1879 of file time_conversions.hpp.
const T time_shield::month_of_year | ( | const std::string & | month | ) |
Alias for get_month_number function.
Get the month number by name.
T | The return type, default is Month enum. |
month | The name of the month as a string. |
std::invalid_argument | if the month name is invalid. |
Definition at line 59 of file time_parser.hpp.
const bool time_shield::month_of_year | ( | const std::string & | month, |
T & | value ) |
Alias for try_get_month_number function.
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 108 of file time_parser.hpp.
|
inlinenoexcept |
Get the month of the year.
This function returns the month of the year for the specified timestamp.
ts | Timestamp. |
Definition at line 1461 of file time_conversions.hpp.
|
noexcept |
Get the millisecond part of the current second.
T | Type of the returned value (default is int). |
Definition at line 49 of file time_utils.hpp.
|
constexprnoexcept |
Get the millisecond part of the second from a floating-point timestamp.
T | Type of the returned value (default is int). |
ts | Timestamp in floating-point seconds. |
Definition at line 44 of file time_conversions.hpp.
|
constexprnoexcept |
Get the millisecond part of the timestamp.
T | Type of the returned value (default is int). |
ts | Timestamp in milliseconds. |
Definition at line 54 of file time_conversions.hpp.
|
constexprnoexcept |
Converts a timestamp from milliseconds to floating-point seconds.
T | The type of the input timestamp (default is ts_ms_t). |
ts_ms | Timestamp in milliseconds. |
Definition at line 113 of file time_conversions.hpp.
|
constexprnoexcept |
Converts a timestamp from milliseconds to seconds.
T1 | The type of the output timestamp (default is ts_t). |
T2 | The type of the input timestamp (default is ts_ms_t). |
ts_ms | Timestamp in milliseconds. |
Definition at line 104 of file time_conversions.hpp.
|
constexpr |
Alias for start_of_next_day function.
Get timestamp of the first day after a specified number of days.
This function returns the timestamp of the start of the day after a specified number of days.
ts | Current timestamp. |
days | Number of days after the current day (default is 1). |
Definition at line 1713 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Definition at line 98 of file time_utils.hpp.
|
inlinenoexcept |
Get the nanosecond part of the current second.
T | Type of the returned value (default is int). |
Definition at line 31 of file time_utils.hpp.
|
constexprnoexcept |
Get the nanosecond part of the second from a floating-point timestamp.
T | Type of the returned value (default is int). |
ts | Timestamp in floating-point seconds. |
Definition at line 24 of file time_conversions.hpp.
|
constexprnoexcept |
Get the number of days in a month.
This function calculates and returns the number of days in the specified month and year.
year | Year as an integer. |
month | Month as an integer. |
Definition at line 1527 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for num_days_in_month_ts function.
Get the number of days in the month of the given timestamp.
This function calculates and returns the number of days in the month of the specified timestamp.
ts | The timestamp to extract month and year from. |
Definition at line 1565 of file time_conversions.hpp.
|
noexcept |
Get the number of days in the month of the given timestamp.
This function calculates and returns the number of days in the month of the specified timestamp.
ts | The timestamp to extract month and year from. |
Definition at line 1553 of file time_conversions.hpp.
|
constexprnoexcept |
Get the number of days in a given year.
This function calculates and returns the number of days in the specified year.
year | Year. |
Definition at line 1585 of file time_conversions.hpp.
|
constexpr |
Get the number of days in the current year.
This function calculates and returns the number of days in the current year based on the provided timestamp.
ts | Timestamp. |
Definition at line 1606 of file time_conversions.hpp.
const bool time_shield::parse_iso8601 | ( | const std::string & | input, |
DateTimeStruct & | dt, | ||
TimeZoneStruct & | tz ) |
Parse a date and time string in ISO8601 format.
This function parses a date and time string in the ISO8601 format and fills the provided DateTimeStruct and TimeZoneStruct with the parsed values.
input | The input string in ISO8601 format. |
dt | The DateTimeStruct to be filled with the parsed date and time values. |
tz | The TimeZoneStruct to be filled with the parsed time zone values. |
Definition at line 154 of file time_parser.hpp.
const bool time_shield::parse_time_zone | ( | const std::string & | tz_str, |
TimeZoneStruct & | tz ) |
Parse a time zone string into a TimeZoneStruct.
This function parses a time zone string in the format "+hh:mm" or "Z" into a TimeZoneStruct. If the string is empty or "Z", it sets the time zone to UTC.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 120 of file time_parser.hpp.
|
inline |
Alias for parse_time_zone function.
Parse a time zone string into a TimeZoneStruct.
This function parses a time zone string in the format "+hh:mm" or "Z" into a TimeZoneStruct. If the string is empty or "Z", it sets the time zone to UTC.
tz_str | The time zone string. |
tz | The TimeZoneStruct to be filled. |
Definition at line 141 of file time_parser.hpp.
|
constexpr |
Alias for start_of_prev_day function.
Get timestamp of the start of the previous day.
This function returns the timestamp at the start of the previous day.
ts | Timestamp of the current day. |
days | Number of days to go back (default is 1). |
Definition at line 1654 of file time_conversions.hpp.
|
inline |
Definition at line 17 of file time_formatting.hpp.
Alias for start_of_saturday function.
Get the timestamp of the start of Saturday.
This function finds the timestamp of the beginning of the day on Saturday, which corresponds to the start of Saturday.
ts | Timestamp (default: current timestamp). |
Definition at line 2120 of file time_conversions.hpp.
|
constexprnoexcept |
Get the second of the day.
This function returns a value between 0 and MAX_SEC_PER_DAY representing the second of the day, given the hour, minute, and second.
T1 | The return type of the function (default is int). |
T2 | The type of the hour, minute, and second parameters (default is int). |
hour | Hour of the day. |
min | Minute of the hour. |
sec | Second of the minute. |
Definition at line 1090 of file time_conversions.hpp.
Get the second of the day.
This function returns a value from 0 to MAX_SEC_PER_DAY representing the second of the day.
T | The return type of the function (default is int). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1063 of file time_conversions.hpp.
|
constexprnoexcept |
Get the second of the day from milliseconds timestamp.
This function returns a value from 0 to MAX_SEC_PER_DAY representing the second of the day, given a timestamp in milliseconds.
T | The return type of the function (default is int). |
ts_ms | Timestamp in milliseconds. |
Definition at line 1075 of file time_conversions.hpp.
Get the second of the hour.
This function returns a value between 0 and 3599 representing the second of the hour.
T | The return type of the function (default is int). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1117 of file time_conversions.hpp.
Get the second of the minute.
This function returns a value between 0 and 59 representing the second of the minute.
T | The return type of the function (default is int). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1105 of file time_conversions.hpp.
|
constexprnoexcept |
Converts a timestamp from seconds to milliseconds.
T1 | The type of the output timestamp (default is ts_ms_t). |
T2 | The type of the input timestamp. |
ts | Timestamp in seconds. |
Definition at line 76 of file time_conversions.hpp.
|
constexprnoexcept |
Definition at line 65 of file time_conversions.hpp.
|
constexprnoexcept |
Definition at line 60 of file time_conversions.hpp.
Get the start of the day timestamp.
This function returns the timestamp at the start of the day. The function sets the hours, minutes, and seconds to zero.
ts | Timestamp. |
Definition at line 1627 of file time_conversions.hpp.
Get the start of the day timestamp in milliseconds.
This function returns the timestamp at the start of the day in milliseconds. The function sets the hours, minutes, seconds, and milliseconds to zero.
ts_ms | Timestamp in milliseconds. |
Definition at line 1686 of file time_conversions.hpp.
Get the start of the day timestamp in seconds.
This function returns the timestamp at the start of the day in seconds. The function sets the hours, minutes, and seconds to zero.
ts_ms | Timestamp in milliseconds. |
Definition at line 1667 of file time_conversions.hpp.
Get the timestamp at the start of the hour.
This function sets the minute and second to zero.
ts | Timestamp (default: current timestamp). |
Definition at line 1951 of file time_conversions.hpp.
Get the timestamp at the start of the hour. This function sets the minute and second to zero.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 1985 of file time_conversions.hpp.
Get the timestamp at the start of the hour.
This function sets the minute and second to zero.
ts_ms | Timestamp in milliseconds (default: current timestamp in milliseconds). |
Definition at line 1969 of file time_conversions.hpp.
Get the timestamp of the beginning of the minute.
ts | Timestamp (default: current timestamp). |
Definition at line 2129 of file time_conversions.hpp.
|
inline |
Get the timestamp at the start of the current month.
This function returns the timestamp at the start of the current month, setting the day to the first day of the month and the time to 00:00:00.
ts | Timestamp (default is current timestamp) |
Definition at line 1873 of file time_conversions.hpp.
|
constexpr |
Get timestamp of the first day after a specified number of days.
This function returns the timestamp of the start of the day after a specified number of days.
ts | Current timestamp. |
days | Number of days after the current day (default is 1). |
Definition at line 1706 of file time_conversions.hpp.
|
constexpr |
Get the timestamp of the start of the period.
p | Period duration in seconds. |
ts | Timestamp (default: current timestamp). |
Definition at line 2183 of file time_conversions.hpp.
|
constexpr |
Get timestamp of the start of the previous day.
This function returns the timestamp at the start of the previous day.
ts | Timestamp of the current day. |
days | Number of days to go back (default is 1). |
Definition at line 1647 of file time_conversions.hpp.
Get the timestamp of the start of Saturday.
This function finds the timestamp of the beginning of the day on Saturday, which corresponds to the start of Saturday.
ts | Timestamp (default: current timestamp). |
Definition at line 2114 of file time_conversions.hpp.
Get the timestamp of the beginning of the week.
This function finds the timestamp of the beginning of the week, which corresponds to the start of Sunday.
ts | Timestamp (default: current timestamp). |
Definition at line 2076 of file time_conversions.hpp.
|
inlinenoexcept |
Get the start of the year timestamp.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts | Timestamp. |
Definition at line 1186 of file time_conversions.hpp.
|
inline |
Get the timestamp of the start of the year.
This function returns the timestamp at the start of the specified year.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1287 of file time_conversions.hpp.
|
inline |
Get the timestamp in milliseconds of the start of the year.
This function returns the timestamp at the start of the specified year in milliseconds.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1329 of file time_conversions.hpp.
|
inlinenoexcept |
Get the start of the year timestamp in milliseconds.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts_ms | Timestamp in milliseconds. |
Definition at line 1261 of file time_conversions.hpp.
|
inline |
Convert an ISO8601 string to a floating-point timestamp (fts_t).
This function parses a string in ISO8601 format and converts it to a floating-point timestamp.
str | The ISO8601 string. |
ts | The floating-point timestamp to be filled. |
Definition at line 231 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp.
str | The ISO8601 string. |
ts | The timestamp to be filled. |
Definition at line 199 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp.
str | The ISO8601 string. |
ts | The millisecond timestamp to be filled. |
Definition at line 215 of file time_parser.hpp.
|
inline |
Converts a TimeZoneStruct to a single integer representation.
tz | The TimeZoneStruct to convert. |
Definition at line 81 of file time_zone_struct.hpp.
|
inline |
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 59 of file time_zone_struct.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in seconds.
Definition at line 63 of file time_utils.hpp.
|
inline |
Alias for tm_to_timestamp function.
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 560 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp function.
Converts a date-time structure to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 511 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp function.
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 438 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Definition at line 91 of file time_utils.hpp.
|
inline |
Alias for tm_to_timestamp_ms function.
Converts a std::tm structure to a timestamp in milliseconds.
This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
Definition at line 730 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp_ms function.
Converts a date-time structure to a timestamp in milliseconds.
This function converts a given date-time structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 688 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp_ms function.
Converts a date and time to a timestamp in milliseconds.
This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 633 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in microseconds.
Definition at line 112 of file time_utils.hpp.
|
inline |
Converts a std::tm structure to a floating-point timestamp.
This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
timeinfo | Pointer to the std::tm structure containing the date and time. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 872 of file time_conversions.hpp.
|
inline |
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 526 of file time_conversions.hpp.
|
inline |
Converts a std::tm structure to a timestamp in milliseconds.
This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
Definition at line 702 of file time_conversions.hpp.
const char * time_shield::to_cstr | ( | const Month & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
const char * time_shield::to_cstr | ( | const TimeZone & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
const char * time_shield::to_cstr | ( | const Weekday & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
T1 time_shield::to_date_time | ( | const T2 & | ts | ) |
Converts a timestamp to a date-time structure.
This function converts a timestamp (usually an integer representing seconds since epoch) to a custom date-time structure. The default type for the timestamp is int64_t.
T1 | The date-time structure type to be returned. |
T2 | The type of the timestamp (default is int64_t). |
ts | The timestamp to be converted. |
Definition at line 199 of file time_conversions.hpp.
|
inline |
Converts a timestamp in milliseconds to a date-time structure with milliseconds.
T | The type of the date-time structure to return. |
ts | The timestamp in milliseconds to convert. |
Definition at line 310 of file time_conversions.hpp.
T1 time_shield::to_dt | ( | const T2 & | ts | ) |
Alias for to_date_time function.
Converts a timestamp to a date-time structure.
This function converts a timestamp (usually an integer representing seconds since epoch) to a custom date-time structure. The default type for the timestamp is int64_t.
T1 | The date-time structure type to be returned. |
T2 | The type of the timestamp (default is int64_t). |
ts | The timestamp to be converted. |
Definition at line 299 of file time_conversions.hpp.
|
inline |
Alias for to_date_time_ms function.
Converts a timestamp in milliseconds to a date-time structure with milliseconds.
T | The type of the date-time structure to return. |
ts | The timestamp in milliseconds to convert. |
Definition at line 319 of file time_conversions.hpp.
|
inline |
Alias for tm_to_ftimestamp function.
Converts a std::tm structure to a floating-point timestamp.
This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
timeinfo | Pointer to the std::tm structure containing the date and time. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 879 of file time_conversions.hpp.
|
inline |
Alias for dt_to_ftimestamp function.
Converts a date-time structure to a floating-point timestamp.
This function converts a given date and time structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure containing year, month, day, hour, minute, second, and millisecond fields. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 832 of file time_conversions.hpp.
|
inline |
Converts a date and time to a floating-point timestamp.
This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is year_t). |
T2 | The type of the month, day, hour, minute, and second parameters (default is int). |
T3 | The type of the millisecond parameter (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 756 of file time_conversions.hpp.
|
inline |
Alias for tm_to_ftimestamp function.
Converts a std::tm structure to a floating-point timestamp.
This function converts a given std::tm structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
timeinfo | Pointer to the std::tm structure containing the date and time. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 886 of file time_conversions.hpp.
|
inline |
Alias for dt_to_ftimestamp function.
Converts a date-time structure to a floating-point timestamp.
This function converts a given date and time structure to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure containing year, month, day, hour, minute, second, and millisecond fields. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 840 of file time_conversions.hpp.
|
inline |
Alias for to_ftimestamp function.
Converts a date and time to a floating-point timestamp.
This function converts a given date and time to a floating-point timestamp, which is the number of seconds (with fractional milliseconds) since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is year_t). |
T2 | The type of the month, day, hour, minute, and second parameters (default is int). |
T3 | The type of the millisecond parameter (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 771 of file time_conversions.hpp.
|
inline |
Converts a timestamp to an ISO8601 date string.
This function converts the date part of a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 455 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string.
This function converts a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 436 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string with timezone offset.
This function converts a timestamp to a string in ISO8601 format with timezone offset.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
utc_offset | The timezone offset in seconds. |
Definition at line 554 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to an ISO8601 string.
This function converts a timestamp in milliseconds to a string in ISO8601 format.
ts_ms | The timestamp in milliseconds to convert. |
Definition at line 538 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to an ISO8601 string with timezone offset.
This function converts a timestamp in milliseconds to a string in ISO8601 format with timezone offset.
ts_ms | The timestamp in milliseconds to convert. |
utc_offset | The timezone offset in seconds. |
Definition at line 581 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 time string.
This function converts the time part of a timestamp to a string in ISO8601 format.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 470 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 UTC time string.
This function converts the time part of a timestamp to a string in ISO8601 format with 'Z' indicating UTC.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 489 of file time_formatting.hpp.
|
inline |
Converts a timestamp to an ISO8601 string in UTC format.
This function converts a timestamp to a string in ISO8601 format with UTC timezone.
T | The type of the timestamp (default is ts_t). |
ts | The timestamp to convert. |
Definition at line 508 of file time_formatting.hpp.
|
inline |
Converts a timestamp in milliseconds to an ISO8601 string in UTC format.
This function converts a timestamp in milliseconds to a string in ISO8601 format with UTC timezone.
ts_ms | The timestamp in milliseconds to convert. |
Definition at line 525 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 date format.
This function converts a timestamp to a string in MQL5 date format (yyyy.mm.dd).
ts | The timestamp to convert. |
Definition at line 618 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 date and time format.
This function converts a timestamp to a string in MQL5 date and time format (yyyy.mm.dd hh:mi:ss).
ts | The timestamp to convert. |
Definition at line 599 of file time_formatting.hpp.
|
inline |
Alias for to_mql5_date_time_str function.
Converts a timestamp to a string in MQL5 date and time format.
This function converts a timestamp to a string in MQL5 date and time format (yyyy.mm.dd hh:mi:ss).
ts | The timestamp to convert. |
Definition at line 608 of file time_formatting.hpp.
|
inline |
Converts a timestamp to a string in MQL5 time format.
This function converts a timestamp to a string in MQL5 time format (hh:mi:ss).
ts | The timestamp to convert. |
Definition at line 631 of file time_formatting.hpp.
|
inline |
Alias for time_zone_struct_to_offset function.
Converts a TimeZoneStruct to a single integer representation.
tz | The TimeZoneStruct to convert. |
Definition at line 93 of file time_zone_struct.hpp.
const std::string & time_shield::to_str | ( | const Month & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
|
inline |
Alias for to_string function.
Convert timestamp to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 421 of file time_formatting.hpp.
const std::string & time_shield::to_str | ( | const TimeZone & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
Converts a TimeZone enum value to a string.
value | The TimeZone enum value to convert. |
format | The format to use for the string representation (default is UPPERCASE_NAME). |
|
inline |
Alias for time_zone_struct_to_string function.
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 72 of file time_zone_struct.hpp.
const std::string & time_shield::to_str | ( | const Weekday & | value, |
const FormatType & | format = UPPERCASE_NAME ) |
const std::string time_shield::to_string | ( | const std::string & | format_str, |
const T & | timestamp, | ||
const tz_t & | utc_offset = 0 ) |
Convert timestamp to string with custom format.
This function is similar to the strftime function and supports the majority of its specifiers, as well as additional ones: YY, YYYY, YYYYYY, WWW, www, hh, mm, ss, dd, sss.
The function accepts the following format specifiers as parameters:
For more information, see the strftime specifiers documentation:
format_str | Format string with custom parameters, e.g., "%H:%M:%S". |
timestamp | Timestamp. |
utc_offset | UTC offset in seconds (default is 0). |
Definition at line 370 of file time_formatting.hpp.
|
inline |
Alias for time_zone_struct_to_string function.
Converts a TimeZoneStruct to a string representation.
tz | The TimeZoneStruct to convert. |
Definition at line 66 of file time_zone_struct.hpp.
|
inline |
Converts an integer to a time zone structure.
T | The type of the time zone structure (default is TimeZoneStruct). |
offset | The integer to convert. |
The function assumes that the type T has members hour
, min
, and is_positive
.
Definition at line 2206 of file time_conversions.hpp.
|
inline |
Converts an integer to a TimeZoneStruct.
offset | The integer to convert. |
Definition at line 39 of file time_zone_struct.hpp.
|
inline |
Alias for tm_to_timestamp function.
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 539 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp function.
Converts a date-time structure to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 487 of file time_conversions.hpp.
|
inline |
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 341 of file time_conversions.hpp.
|
inline |
Alias for tm_to_timestamp_ms function.
Converts a std::tm structure to a timestamp in milliseconds.
This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
Definition at line 709 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp_ms function.
Converts a date-time structure to a timestamp in milliseconds.
This function converts a given date-time structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 664 of file time_conversions.hpp.
|
inline |
Converts a date and time to a timestamp in milliseconds.
This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 591 of file time_conversions.hpp.
|
inline |
Alias for tm_to_timestamp function.
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 546 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp function.
Converts a date-time structure to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 495 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp function.
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 399 of file time_conversions.hpp.
|
inline |
Alias for tm_to_timestamp_ms function.
Converts a std::tm structure to a timestamp in milliseconds.
This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
Definition at line 716 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp_ms function.
Converts a date-time structure to a timestamp in milliseconds.
This function converts a given date-time structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 672 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp_ms function.
Converts a date and time to a timestamp in milliseconds.
This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 605 of file time_conversions.hpp.
|
inline |
Alias for to_time_zone_struct function.
Converts an integer to a TimeZoneStruct.
offset | The integer to convert. |
Definition at line 50 of file time_zone_struct.hpp.
Alias for get_unix_min function.
Get UNIX minute.
This function returns the number of minutes elapsed since the UNIX epoch.
T | The return type of the function (default is int64_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1042 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_unix_year function.
Converts a UNIX timestamp to a year.
T | The type of the year (default is year_t). |
ts | UNIX timestamp. |
Definition at line 164 of file time_conversions.hpp.
|
inline |
Alias for get_year function.
Get the year from the timestamp.
This function returns the year of the specified timestamp in seconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1145 of file time_conversions.hpp.
|
inline |
Alias for get_year_ms function.
Get the year from the timestamp in milliseconds.
This function returns the year of the specified timestamp in milliseconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts_ms | Timestamp in milliseconds (default is current timestamp). |
Definition at line 1173 of file time_conversions.hpp.
const bool time_shield::try_get_month_number | ( | const std::string & | month, |
T & | value ) |
Get the month number by name, with output parameter.
T | The type for the month number, default is Month enum. |
month | The name of the month as a string. |
value | The reference to store the month number if found. |
Definition at line 71 of file time_parser.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in seconds.
Definition at line 56 of file time_utils.hpp.
|
inline |
Convert an ISO8601 C-style string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp. If parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 281 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a timestamp (ts_t).
This function parses a string in ISO8601 format and converts it to a timestamp. If parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 247 of file time_parser.hpp.
|
inline |
Alias for tm_to_timestamp function.
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 553 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp function.
Converts a date-time structure to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 503 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp function.
Converts a date and time to a timestamp.
This function converts a given date and time to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 425 of file time_conversions.hpp.
|
inline |
Alias for tm_to_timestamp function.
Converts a std::tm structure to a timestamp.
This function converts a standard C++ std::tm structure to a timestamp, which is the number of seconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 567 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in milliseconds.
Definition at line 84 of file time_utils.hpp.
|
inline |
Convert an ISO8601 C-style string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp. If parsing fails, it returns 0.
str | The ISO8601 C-style string. |
Definition at line 292 of file time_parser.hpp.
|
inline |
Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
This function parses a string in ISO8601 format and converts it to a millisecond timestamp. If parsing fails, it returns 0.
str | The ISO8601 string. |
Definition at line 258 of file time_parser.hpp.
|
inline |
Alias for tm_to_timestamp_ms function.
Converts a std::tm structure to a timestamp in milliseconds.
This function converts a given std::tm structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
timeinfo | Pointer to a std::tm structure containing the date and time information. |
Definition at line 723 of file time_conversions.hpp.
|
inline |
Alias for dt_to_timestamp_ms function.
Converts a date-time structure to a timestamp in milliseconds.
This function converts a given date-time structure to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T | The type of the date-time structure. |
date_time | The date-time structure. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 680 of file time_conversions.hpp.
|
inline |
Alias for to_timestamp_ms function.
Converts a date and time to a timestamp in milliseconds.
This function converts a given date and time to a timestamp in milliseconds, which is the number of milliseconds since the Unix epoch (January 1, 1970).
T1 | The type of the year parameter (default is int64_t). |
T2 | The type of the other date and time parameters (default is int). |
year | The year value. |
month | The month value. |
day | The day value. |
hour | The hour value (default is 0). |
min | The minute value (default is 0). |
sec | The second value (default is 0). |
ms | The millisecond value (default is 0). |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 619 of file time_conversions.hpp.
|
inlinenoexcept |
Get the current UTC timestamp in microseconds.
Definition at line 105 of file time_utils.hpp.
|
inline |
Alias for time_zone_struct_to_offset function.
Converts a TimeZoneStruct to a single integer representation.
tz | The TimeZoneStruct to convert. |
Definition at line 87 of file time_zone_struct.hpp.
Alias for get_unix_day function.
Get UNIX day.
This function returns the number of days elapsed since the UNIX epoch.
T | The return type of the function (default is unix_day_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 929 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_unix_day_ms function.
Get UNIX day from milliseconds timestamp.
This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.
T | The return type of the function (default is unix_day_t). |
t_ms | Timestamp in milliseconds (default is current timestamp in milliseconds). |
Definition at line 986 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for unix_day_to_timestamp function.
Convert a UNIX day to a timestamp.
This function converts a number of days since the UNIX epoch to a timestamp in seconds.
T | The return type of the function (default is ts_t). |
unix_day | Number of days since the beginning of UNIX time. |
Definition at line 1014 of file time_conversions.hpp.
Alias for get_unix_min function.
Get UNIX minute.
This function returns the number of minutes elapsed since the UNIX epoch.
T | The return type of the function (default is int64_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1049 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_unix_day function.
Get UNIX day.
This function returns the number of days elapsed since the UNIX epoch.
T | The return type of the function (default is unix_day_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 922 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_unix_day_ms function.
Get UNIX day from milliseconds timestamp.
This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.
T | The return type of the function (default is unix_day_t). |
t_ms | Timestamp in milliseconds (default is current timestamp in milliseconds). |
Definition at line 979 of file time_conversions.hpp.
|
constexprnoexcept |
Convert a UNIX day to a timestamp.
This function converts a number of days since the UNIX epoch to a timestamp in seconds.
T | The return type of the function (default is ts_t). |
unix_day | Number of days since the beginning of UNIX time. |
Definition at line 1000 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for unix_day_to_timestamp function.
Convert a UNIX day to a timestamp.
This function converts a number of days since the UNIX epoch to a timestamp in seconds.
T | The return type of the function (default is ts_t). |
unix_day | Number of days since the beginning of UNIX time. |
Definition at line 1007 of file time_conversions.hpp.
Alias for get_unix_min function.
Get UNIX minute.
This function returns the number of minutes elapsed since the UNIX epoch.
T | The return type of the function (default is int64_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1035 of file time_conversions.hpp.
|
constexprnoexcept |
Alias for get_unix_year function.
Converts a UNIX timestamp to a year.
T | The type of the year (default is year_t). |
ts | UNIX timestamp. |
Definition at line 157 of file time_conversions.hpp.
|
noexcept |
Get the microsecond part of the current second.
T | Type of the returned value (default is int). |
Definition at line 40 of file time_utils.hpp.
|
constexprnoexcept |
Get the microsecond part of the second from a floating-point timestamp.
T | Type of the returned value (default is int). |
ts | Timestamp in floating-point seconds. |
Definition at line 34 of file time_conversions.hpp.
Alias for start_of_week function.
Get the timestamp of the beginning of the week.
This function finds the timestamp of the beginning of the week, which corresponds to the start of Sunday.
ts | Timestamp (default: current timestamp). |
Definition at line 2082 of file time_conversions.hpp.
|
inline |
Alias for get_year function.
Get the year from the timestamp.
This function returns the year of the specified timestamp in seconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts | Timestamp in seconds (default is current timestamp). |
Definition at line 1138 of file time_conversions.hpp.
|
inline |
Alias for start_of_year function.
Get the start of the year timestamp.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts | Timestamp. |
Definition at line 1248 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_date function.
Get the timestamp of the start of the year.
This function returns the timestamp at the start of the specified year.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1315 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_date_ms function.
Get the timestamp in milliseconds of the start of the year.
This function returns the timestamp at the start of the specified year in milliseconds.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1343 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_ms function.
Get the start of the year timestamp in milliseconds.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts_ms | Timestamp in milliseconds. |
Definition at line 1273 of file time_conversions.hpp.
|
inline |
Alias for end_of_year function.
Get the end-of-year timestamp.
This function finds the last timestamp of the current year.
ts | Timestamp. |
Definition at line 1416 of file time_conversions.hpp.
|
inline |
Alias for end_of_year_ms function.
Get the timestamp in milliseconds of the end of the year.
This function finds the last timestamp of the current year in milliseconds.
ts_ms | Timestamp in milliseconds. |
Definition at line 1435 of file time_conversions.hpp.
|
inline |
Alias for get_year_ms function.
Get the year from the timestamp in milliseconds.
This function returns the year of the specified timestamp in milliseconds since the Unix epoch.
T | The return type of the function (default is year_t). |
ts_ms | Timestamp in milliseconds (default is current timestamp). |
Definition at line 1166 of file time_conversions.hpp.
|
inline |
Alias for start_of_year function.
Get the start of the year timestamp.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts | Timestamp. |
Definition at line 1242 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_date function.
Get the timestamp of the start of the year.
This function returns the timestamp at the start of the specified year.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1308 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_date_ms function.
Get the timestamp in milliseconds of the start of the year.
This function returns the timestamp at the start of the specified year in milliseconds.
year | Year. |
std::invalid_argument | if the date-time combination is invalid. |
Definition at line 1336 of file time_conversions.hpp.
|
inline |
Alias for start_of_year_ms function.
Get the start of the year timestamp in milliseconds.
This function resets the days, months, hours, minutes, and seconds of the given timestamp to the beginning of the year.
ts_ms | Timestamp in milliseconds. |
Definition at line 1267 of file time_conversions.hpp.
|
constexpr |
Average days per year.
Definition at line 70 of file constants.hpp.
|
constexpr |
Average seconds per year (365.25 days)
Definition at line 33 of file constants.hpp.
|
constexpr |
Days per 4 years.
Definition at line 53 of file constants.hpp.
|
constexpr |
Days per leap year.
Definition at line 51 of file constants.hpp.
|
constexpr |
Days per week.
Definition at line 50 of file constants.hpp.
|
constexpr |
Days per year.
Definition at line 52 of file constants.hpp.
|
constexpr |
Error timestamp value.
Definition at line 68 of file constants.hpp.
|
constexpr |
Error year value.
Definition at line 66 of file constants.hpp.
|
constexpr |
Hours per day.
Definition at line 49 of file constants.hpp.
const int64_t time_shield::LEAP_YEAR_PER_100_YEAR = 24 |
Leap years per 100 years.
Definition at line 58 of file constants.hpp.
const int64_t time_shield::LEAP_YEAR_PER_400_YEAR = 97 |
Leap years per 400 years.
Definition at line 59 of file constants.hpp.
const int64_t time_shield::MAX_DAYS_PER_MONTH = 31 |
Maximum days per month.
Definition at line 57 of file constants.hpp.
|
constexpr |
Maximum lunar minutes.
Definition at line 46 of file constants.hpp.
|
constexpr |
Maximum OLE automation date.
Definition at line 69 of file constants.hpp.
|
constexpr |
Maximum seconds per day.
Definition at line 39 of file constants.hpp.
|
constexpr |
Maximum timestamp value.
Definition at line 67 of file constants.hpp.
|
constexpr |
Maximum representable year.
Definition at line 64 of file constants.hpp.
|
constexpr |
Minutes per day.
Definition at line 43 of file constants.hpp.
|
constexpr |
Minutes per hour.
Definition at line 42 of file constants.hpp.
|
constexpr |
Minutes per month (28 days)
Definition at line 45 of file constants.hpp.
|
constexpr |
Minutes per week.
Definition at line 44 of file constants.hpp.
|
constexpr |
Minimum representable year.
Definition at line 65 of file constants.hpp.
const int64_t time_shield::MONTHS_PER_YEAR = 12 |
Months per year.
Definition at line 56 of file constants.hpp.
|
constexpr |
Milliseconds per day.
Definition at line 25 of file constants.hpp.
|
constexpr |
Milliseconds per half hour.
Definition at line 23 of file constants.hpp.
|
constexpr |
Milliseconds per hour.
Definition at line 24 of file constants.hpp.
|
constexpr |
Milliseconds per minute.
Definition at line 22 of file constants.hpp.
|
constexpr |
Milliseconds per second.
Definition at line 21 of file constants.hpp.
|
constexpr |
Nanoseconds per millisecond.
Definition at line 16 of file constants.hpp.
|
constexpr |
Nanoseconds per second.
Definition at line 17 of file constants.hpp.
|
constexpr |
Nanoseconds per microsecond.
Definition at line 15 of file constants.hpp.
|
constexpr |
OLE automation date since UNIX epoch.
Definition at line 63 of file constants.hpp.
|
constexpr |
Seconds per 100 years.
Definition at line 37 of file constants.hpp.
|
constexpr |
Seconds per 400 years.
Definition at line 38 of file constants.hpp.
|
constexpr |
Seconds per 4 years.
Definition at line 35 of file constants.hpp.
|
constexpr |
Seconds per day.
Definition at line 31 of file constants.hpp.
|
constexpr |
Seconds per first 100 years.
Definition at line 36 of file constants.hpp.
|
constexpr |
Seconds per half hour.
Definition at line 29 of file constants.hpp.
|
constexpr |
Seconds per hour.
Definition at line 30 of file constants.hpp.
|
constexpr |
Seconds per leap year (366 days)
Definition at line 34 of file constants.hpp.
|
constexpr |
Seconds per minute.
Definition at line 28 of file constants.hpp.
|
constexpr |
Seconds per year (365 days)
Definition at line 32 of file constants.hpp.
|
constexpr |
Start year of UNIX time.
Definition at line 62 of file constants.hpp.
|
constexpr |
Microseconds per second.
Definition at line 20 of file constants.hpp.