Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
time_shield Namespace Reference

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...
 
class  NtpClient
 Simple Windows-only NTP client for measuring time offset. More...
 
struct  TimeStruct
 Structure to represent time. More...
 
struct  TimeZoneStruct
 Structure to represent time zone information. More...
 
class  WsaGuard
 Singleton guard for WinSock initialization. More...
 

Typedefs

typedef int64_t year_t
 Year as an integer (e.g., 2024).
 
typedef int64_t uday_t
 Unix day count since 1970‑01‑01 (days since epoch).
 
using unixday_t = uday_t
 Alias for Unix day count type.
 
typedef int64_t ts_t
 Unix timestamp in seconds since 1970‑01‑01T00:00:00Z.
 
typedef int64_t ts_ms_t
 Unix timestamp in milliseconds since epoch.
 
typedef int64_t ts_us_t
 Unix timestamp in microseconds since epoch.
 
typedef double fts_t
 Floating-point timestamp (fractional seconds since epoch).
 
typedef double oadate_t
 OLE Automation date (days since 1899‑12‑30, as double).
 
typedef double jd_t
 Julian Date (days since -4713‑11‑24T12:00:00Z).
 
typedef double mjd_t
 Modified Julian Date (JD − 2400000.5).
 
typedef uint64_t jdn_t
 Julian Day Number (whole days since Julian epoch).
 
typedef int32_t tz_t
 Time zone offset in minutes from UTC (e.g., +180 = UTC+3).
 

Enumerations

enum  FormatType {
  UPPERCASE_NAME = 0 , SHORT_NAME , FULL_NAME , UPPERCASE_NAME = 0 ,
  SHORT_NAME , FULL_NAME
}
 
enum  Weekday {
  SUN = 0 , MON , TUE , WED ,
  THU , FRI , SAT , SUN = 0 ,
  MON , TUE , WED , THU ,
  FRI , SAT
}
 
enum  Month {
  JAN = 1 , FEB , MAR , APR ,
  MAY , JUN , JUL , AUG ,
  SEP , OCT , NOV , DEC ,
  JAN = 1 , FEB , MAR , APR ,
  MAY , JUN , JUL , AUG ,
  SEP , OCT , NOV , DEC
}
 
enum  TimeZone {
  GMT , UTC , EET , CET ,
  WET , EEST , CEST , WEST ,
  UNKNOWN , GMT , UTC , EET ,
  CET , WET , EEST , CEST ,
  WEST , UNKNOWN
}
 
enum  MoonPhase {
  WAXING_CRESCENT , FIRST_QUARTER , WAXING_GIBBOUS , FULL_MOON ,
  WANING_GIBBOUS , LAST_QUARTER , WANING_CRESCENT , NEW_MOON ,
  WAXING_CRESCENT , FIRST_QUARTER , WAXING_GIBBOUS , FULL_MOON ,
  WANING_GIBBOUS , LAST_QUARTER , WANING_CRESCENT , NEW_MOON
}
 
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 , ISO8601_WITH_TZ , ISO8601_NO_TZ , MQL5_FULL ,
  MQL5_DATE_ONLY , MQL5_TIME_ONLY , AMERICAN_MONTH_DAY , EUROPEAN_MONTH_DAY ,
  AMERICAN_TIME , EUROPEAN_TIME
}
 

Functions

const DateStruct create_date_struct (int64_t year, int32_t mon=1, int32_t day=1)
 Creates a DateStruct instance.
 
const DateTimeStruct create_date_time_struct (int64_t year, int mon=1, int day=1, int hour=0, int min=0, int sec=0, int ms=0)
 Creates a DateTimeStruct instance.
 
const char * to_cstr (Weekday value, FormatType format=UPPERCASE_NAME)
 Converts a Weekday enum value to a string.
 
const std::string & to_str (Weekday value, FormatType format=UPPERCASE_NAME)
 Converts a Weekday enum value to a string.
 
const char * to_cstr (Month value, FormatType format=UPPERCASE_NAME)
 Converts a Month enum value to a string.
 
const std::string & to_str (Month value, FormatType format=UPPERCASE_NAME)
 Converts a Month enum value to a string.
 
const char * to_cstr (TimeZone value, FormatType format=UPPERCASE_NAME)
 Converts a TimeZone enum value to a string.
 
const std::string & to_str (TimeZone value, FormatType format=UPPERCASE_NAME)
 Converts a TimeZone enum value to a string.
 
void init ()
 Initializes the Time Shield library.
 
template<class T = Month>
get_month_number (const std::string &month)
 Get the month number by name.
 
template<class T = Month>
month_of_year (const std::string &month)
 Alias for get_month_number function.
 
template<class T = Month>
bool try_get_month_number (const std::string &month, T &value)
 Get the month number by name, with output parameter.
 
template<class T = Month>
bool get_month_number (const std::string &month, T &value)
 Alias for try_get_month_number function.
 
template<class T = Month>
bool month_of_year (const std::string &month, T &value)
 Alias for try_get_month_number function.
 
bool parse_time_zone (const std::string &tz_str, TimeZoneStruct &tz)
 Parse a time zone string into a TimeZoneStruct.
 
bool parse_tz (const std::string &tz_str, TimeZoneStruct &tz)
 Alias for parse_time_zone function.
 
bool parse_iso8601 (const std::string &input, DateTimeStruct &dt, TimeZoneStruct &tz)
 Parse a date and time string in ISO8601 format.
 
bool str_to_ts (const std::string &str, ts_t &ts)
 Convert an ISO8601 string to a timestamp (ts_t).
 
bool str_to_ts_ms (const std::string &str, ts_ms_t &ts)
 Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
 
bool str_to_fts (const std::string &str, fts_t &ts)
 Convert an ISO8601 string to a floating-point timestamp (fts_t).
 
ts_t ts (const std::string &str)
 Convert an ISO8601 string to a timestamp (ts_t).
 
ts_ms_t ts_ms (const std::string &str)
 Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
 
fts_t fts (const std::string &str)
 Convert an ISO8601 string to a floating-point timestamp (fts_t).
 
template<class T = int>
bool sec_of_day (const std::string &str, T &sec)
 Parse time of day string to seconds of day.
 
template<class T = int>
sec_of_day (const std::string &str)
 Convert time of day string to seconds of day.
 
ts_t ts (const char *str)
 Convert an ISO8601 C-style string to a timestamp (ts_t).
 
ts_ms_t ts_ms (const char *str)
 Convert an ISO8601 C-style string to a millisecond timestamp (ts_ms_t).
 
fts_t fts (const char *str)
 Convert an ISO8601 C-style string to a floating-point timestamp (fts_t).
 
const TimeStruct create_time_struct (int16_t hour, int16_t min, int16_t sec=0, int16_t ms=0)
 Creates a TimeStruct instance.
 
const struct timespec get_timespec_impl () noexcept
 Get the current timespec.
 
int64_t now_realtime_us ()
 Get current real time in microseconds using a hybrid method.
 
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.
 
double get_cpu_time () noexcept
 Get the CPU time used by the current process.
 
const TimeZoneStruct create_time_zone_struct (int hour, int min, bool is_positive=true)
 Creates a TimeZoneStruct instance.
 
const TimeZoneStruct to_time_zone_struct (tz_t offset)
 Converts an integer to a TimeZoneStruct.
 
const TimeZoneStruct to_tz (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 (T year) noexcept
 Checks if the given year is a leap year.
 
template<class T = year_t>
constexpr const bool check_leap_year (T year) noexcept
 Alias for is_leap_year_date function.
 
template<class T = year_t>
constexpr const bool leap_year (T year) noexcept
 Alias for is_leap_year_date function.
 
TIME_SHIELD_CONSTEXPR bool is_leap_year_ts (ts_t ts)
 Checks if the given year is a leap year.
 
TIME_SHIELD_CONSTEXPR bool leap_year_ts (ts_t ts)
 Alias for is_leap_year_ts function.
 
TIME_SHIELD_CONSTEXPR bool check_leap_year_ts (ts_t ts)
 Alias for is_leap_year_ts function.
 
TIME_SHIELD_CONSTEXPR bool is_leap_year (ts_t ts)
 Alias for is_leap_year_ts function.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR bool is_valid_time_zone (T hour, T min) noexcept
 Check if the time zone is valid.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR bool is_valid_tz (T hour, T min)
 Alias for is_valid_time_zone function.
 
template<class T = TimeZoneStruct>
TIME_SHIELD_CONSTEXPR 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 bool is_valid_time_zone (const T &time_zone)
 Alias for is_valid_time_zone_offset function.
 
template<class T = TimeZoneStruct>
TIME_SHIELD_CONSTEXPR 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 bool is_valid_time (T1 hour, T1 min, T1 sec, T2 ms=0) noexcept
 Checks the correctness of the specified time.
 
template<class T>
TIME_SHIELD_CONSTEXPR 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 bool is_valid_date (T1 year, T2 month, T2 day) noexcept
 Checks the correctness of the specified date.
 
template<class T>
TIME_SHIELD_CONSTEXPR 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 bool is_valid_date_time (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0) noexcept
 Checks the correctness of a date and time.
 
template<class T>
TIME_SHIELD_CONSTEXPR bool is_valid_date_time (const T &date_time) noexcept
 Checks the correctness of a date and time.
 
TIME_SHIELD_CONSTEXPR bool is_day_off (ts_t ts) noexcept
 Check if a given timestamp corresponds to a weekend day (Saturday or Sunday).
 
TIME_SHIELD_CONSTEXPR bool is_weekend (ts_t ts) noexcept
 Alias for is_day_off function.
 
template<class T = uday_t>
TIME_SHIELD_CONSTEXPR bool is_day_off_unix_day (T unix_day) noexcept
 Check if a given day (since Unix epoch) corresponds to a weekend day (Saturday or Sunday). This function checks if the given day (number of days since Unix epoch) falls on a weekend day, which is either Saturday or Sunday.
 
template<class T = uday_t>
TIME_SHIELD_CONSTEXPR bool is_weekend_unix_day (T unix_day) noexcept
 Alias for is_day_off_unix_day function.
 
DateStruct create_date_struct (const long year, const int mon=1, const int day=1)
 Creates a DateStruct instance.
 
DateTimeStruct create_date_time_struct (const long 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.
 
int ns_of_sec (double ts)
 Get the nanosecond part of a floating-point timestamp.
 
int us_of_sec (double ts)
 Get the microsecond part of a floating-point timestamp.
 
int ms_of_sec (double ts)
 Get the millisecond part of a floating-point timestamp.
 
int ms_of_ts (long ts_ms)
 Get the millisecond part of a millisecond timestamp.
 
long sec_to_ms (double sec)
 Convert seconds to milliseconds.
 
long ms_to_sec (long ms)
 Convert milliseconds to seconds (integer part).
 
double ms_to_fsec (long ms)
 Convert milliseconds to floating-point seconds.
 
long min_to_ms (double min)
 Convert minutes to milliseconds.
 
int ms_to_min (long ms)
 Convert milliseconds to minutes (integer part).
 
long min_to_sec (double min)
 Convert minutes to seconds.
 
int sec_to_min (long sec)
 Convert seconds to minutes (integer part).
 
double min_to_fsec (double min)
 Convert minutes to floating-point seconds.
 
double sec_to_fmin (long sec)
 Convert seconds to floating-point minutes.
 
long hour_to_ms (double hr)
 Convert hours to milliseconds.
 
int ms_to_hour (long ms)
 Convert milliseconds to hours (integer part).
 
long hour_to_sec (double hr)
 Convert hours to seconds.
 
int sec_to_hour (long sec)
 Convert seconds to hours (integer part).
 
double hour_to_fsec (double hr)
 Convert hours to floating-point seconds.
 
double sec_to_fhour (long sec)
 Convert seconds to floating-point hours.
 
int hour24_to_12 (int hour)
 Convert a 24-hour format hour to a 12-hour format.
 
int h24_to_h12 (int hour)
 Alias for hour24_to_12.
 
long get_unix_year (long ts)
 Convert a UNIX timestamp to a year.
 
long unix_year (long ts)
 Alias for get_unix_year function.
 
long to_unix_year (long ts)
 Alias for get_unix_year function.
 
long get_year (long ts)
 Get the year from a timestamp.
 
long year (long ts)
 Alias for get_year.
 
long to_year (long ts)
 Alias for get_year.
 
long get_year_ms (long ts_ms)
 Get the year from a millisecond timestamp.
 
long year_ms (long ts_ms)
 Alias for get_year_ms.
 
long to_year_ms (long ts_ms)
 Alias for get_year_ms.
 
DateTimeStruct to_date_time (long ts)
 Convert a timestamp to a DateTimeStruct.
 
DateTimeStruct to_dt (long ts)
 Alias for to_date_time.
 
MqlDateTime to_date_time_mql (long ts)
 Convert a timestamp to the standard MqlDateTime structure.
 
MqlDateTime to_mql_dt (long ts)
 Alias for to_date_time_mql.
 
DateTimeStruct to_date_time_ms (long ts_ms)
 Convert a timestamp in milliseconds to DateTimeStruct.
 
DateTimeStruct to_dt_ms (long ts_ms)
 Alias for to_date_time_ms.
 
long dt_to_timestamp (const DateTimeStruct &dt)
 Convert a DateTimeStruct to timestamp.
 
long dt_to_timestamp (const MqlDateTime &dt)
 Convert an MqlDateTime structure to timestamp.
 
long to_timestamp (const DateTimeStruct &dt)
 Alias for dt_to_timestamp.
 
long to_timestamp (const MqlDateTime &dt)
 Alias for dt_to_timestamp taking MqlDateTime.
 
long to_timestamp (long year, int mon, int day, int hour=0, int min=0, int sec=0)
 Convert date and time values to a timestamp.
 
long to_ts (long year, int mon, int day, int hour=0, int min=0, int sec=0)
 Alias for to_timestamp with explicit date fields.
 
long to_timestamp_ms (long year, int mon, int day, int hour=0, int min=0, int sec=0, int ms=0)
 Convert date and time values to a timestamp in milliseconds.
 
long to_ts_ms (long year, int mon, int day, int hour=0, int min=0, int sec=0, int ms=0)
 Alias for to_timestamp_ms.
 
long ts_ms (long year, int mon, int day, int hour=0, int min=0, int sec=0, int ms=0)
 Alias for to_timestamp_ms.
 
long dt_to_timestamp_ms (const DateTimeStruct &dt)
 Convert a DateTimeStruct to a timestamp in milliseconds.
 
long dt_to_timestamp_ms (const MqlDateTime &dt)
 Convert an MqlDateTime structure to a timestamp in milliseconds.
 
long to_timestamp_ms (const DateTimeStruct &dt)
 Alias for dt_to_timestamp_ms.
 
long to_timestamp_ms (const MqlDateTime &dt)
 Alias for dt_to_timestamp_ms.
 
double dt_to_ftimestamp (const DateTimeStruct &dt)
 Convert a DateTimeStruct to floating-point timestamp.
 
double dt_to_ftimestamp (const MqlDateTime &dt)
 Convert an MqlDateTime structure to floating-point timestamp.
 
double to_ftimestamp (const DateTimeStruct &dt)
 Alias for dt_to_ftimestamp.
 
double to_ftimestamp (const MqlDateTime &dt)
 Alias for dt_to_ftimestamp.
 
long start_of_day (long ts)
 Get the start of the day for a timestamp.
 
long day_start (long ts)
 Alias for start_of_day.
 
long start_of_prev_day (long ts, int days=1)
 Get the start of the previous day.
 
long previous_day_start (long ts, int days=1)
 Alias for start_of_prev_day.
 
long start_of_day_sec (long ts_ms)
 Get the start of the day in seconds from milliseconds timestamp.
 
long day_start_sec (long ts_ms)
 Alias for start_of_day_sec.
 
long start_of_day_ms (long ts_ms)
 Get the start of the day for a millisecond timestamp.
 
long day_start_ms (long ts_ms)
 Alias for start_of_day_ms.
 
long start_of_next_day (long ts, int days=1)
 Get the start of the next day.
 
long next_day_start (long ts, int days=1)
 Alias for start_of_next_day.
 
long start_of_next_day_ms (long ts_ms, int days=1)
 Get the start of the next day in milliseconds.
 
long next_day_start_ms (long ts_ms, int days=1)
 Alias for start_of_next_day_ms.
 
long next_day (long ts, int days=1)
 Add days to a timestamp without adjusting to start of day.
 
long next_day_ms (long ts_ms, int days=1)
 Add days to a millisecond timestamp without adjusting to start of day.
 
long end_of_day (long ts)
 Get the end of the day for a timestamp.
 
long day_end (long ts)
 Alias for end_of_day.
 
long end_of_day_sec (long ts_ms)
 Get the end of the day in seconds from milliseconds timestamp.
 
long day_end_sec (long ts_ms)
 Alias for end_of_day_sec.
 
long end_of_day_ms (long ts_ms)
 Get the end of the day for a millisecond timestamp.
 
long day_end_ms (long ts_ms)
 Alias for end_of_day_ms.
 
Weekday day_of_week_date (long year, int month, int day)
 Get the day of the week for a date.
 
Weekday get_weekday (long year, int month, int day)
 Alias for day_of_week_date.
 
Weekday day_of_week (long year, int month, int day)
 Alias for day_of_week_date.
 
Weekday get_weekday_from_date (const DateTimeStruct &dt)
 Get weekday from a DateTimeStruct.
 
Weekday get_weekday_from_date (const MqlDateTime &dt)
 Get weekday from a MqlDateTime structure.
 
Weekday day_of_week_dt (const DateTimeStruct &dt)
 Alias for get_weekday_from_date with DateTimeStruct.
 
Weekday day_of_week (const DateTimeStruct &dt)
 Alias for get_weekday_from_date with DateTimeStruct.
 
Weekday day_of_week_dt (const MqlDateTime &dt)
 Alias for get_weekday_from_date with MqlDateTime.
 
Weekday day_of_week (const MqlDateTime &dt)
 Alias for get_weekday_from_date with MqlDateTime.
 
Weekday get_weekday_from_ts (long ts)
 Get weekday from timestamp.
 
Weekday day_of_week (long ts)
 Alias for get_weekday_from_ts.
 
Weekday get_weekday_from_ts_ms (long ts_ms)
 Get weekday from millisecond timestamp.
 
Weekday day_of_week_ms (long ts_ms)
 Alias for get_weekday_from_ts_ms.
 
long start_of_year (long ts)
 Get the start of the year for a timestamp.
 
long end_of_year (long ts)
 Get the end of the year for a timestamp.
 
long year_start (long ts)
 Alias for start_of_year.
 
long year_begin (long ts)
 Alias for start_of_year.
 
long start_of_year_ms (long ts_ms)
 Get the start of the year in milliseconds.
 
long year_start_ms (long ts_ms)
 Alias for start_of_year_ms.
 
long year_begin_ms (long ts_ms)
 Alias for start_of_year_ms.
 
long start_of_year_date (long year)
 Get the timestamp for the start of the specified year.
 
long year_start_date (long year)
 Alias for start_of_year_date.
 
long year_begin_date (long year)
 Alias for start_of_year_date.
 
long start_of_year_date_ms (long year)
 Get the timestamp in milliseconds for the start of the specified year.
 
long year_start_date_ms (long year)
 Alias for start_of_year_date_ms.
 
long year_begin_date_ms (long year)
 Alias for start_of_year_date_ms.
 
long end_of_year_ms (long ts_ms)
 Get the end of the year in milliseconds.
 
long year_end_ms (long ts_ms)
 Alias for end_of_year_ms.
 
int day_of_year (long ts)
 Get the day of the year.
 
Month month_of_year (long ts)
 Get the month of the year.
 
int day_of_month (long ts)
 Get the day of the month.
 
int num_days_in_month (long year, int month)
 Get the number of days in a month.
 
int days_in_month (long year, int month)
 Alias for num_days_in_month.
 
int num_days_in_month_ts (long ts)
 Get the number of days in the month of a timestamp.
 
int num_days_in_month (long ts)
 Alias for num_days_in_month_ts.
 
int days_in_month (long ts)
 Alias for num_days_in_month_ts.
 
int num_days_in_year (long year)
 Get number of days in a year.
 
int days_in_year (long year)
 Alias for num_days_in_year.
 
int num_days_in_year_ts (long ts)
 Get number of days in the year of the timestamp.
 
int days_in_year_ts (long ts)
 Alias for num_days_in_year_ts.
 
long start_of_month (long ts)
 Get the timestamp at the start of the month.
 
long month_begin (long ts)
 Alias for start_of_month.
 
long end_of_month (long ts)
 Get the timestamp at the end of the month.
 
long last_day_of_month (long ts)
 Alias for end_of_month.
 
long last_sunday_of_month (long ts)
 Get the timestamp of the last Sunday of the month.
 
long final_sunday_of_month (long ts)
 Alias for last_sunday_of_month.
 
int last_sunday_month_day (long year, int month)
 Get the day of the last Sunday for the given month and year.
 
int final_sunday_month_day (long year, int month)
 Alias for last_sunday_month_day.
 
long start_of_hour (long ts)
 Get the start of the hour for a timestamp.
 
long hour_begin (long ts)
 Alias for start_of_hour.
 
long start_of_hour_sec (long ts_ms)
 Get the start of the hour in seconds from milliseconds timestamp.
 
long hour_begin_sec (long ts_ms)
 Alias for start_of_hour_sec.
 
long start_of_hour_ms (long ts_ms)
 Get the start of the hour for a millisecond timestamp.
 
long hour_begin_ms (long ts_ms)
 Alias for start_of_hour_ms.
 
long end_of_hour (long ts)
 Get the end of the hour for a timestamp.
 
long finish_of_hour (long ts)
 Alias for end_of_hour.
 
long end_of_hour_sec (long ts_ms)
 Get the end of the hour in seconds from milliseconds timestamp.
 
long finish_of_hour_sec (long ts_ms)
 Alias for end_of_hour_sec.
 
long end_of_hour_ms (long ts_ms)
 Get the end of the hour for a millisecond timestamp.
 
long finish_of_hour_ms (long ts_ms)
 Alias for end_of_hour_ms.
 
int hour_of_day (long ts)
 Get the hour of the day.
 
int hour_in_day (long ts)
 Alias for hour_of_day.
 
long start_of_week (long ts)
 Get the start of the week (Sunday).
 
long week_begin (long ts)
 Alias for start_of_week.
 
long end_of_week (long ts)
 Get the end of the week (Saturday end).
 
long finish_of_week (long ts)
 Alias for end_of_week.
 
long start_of_saturday (long ts)
 Get the start of Saturday for the week of the timestamp.
 
long saturday_begin (long ts)
 Alias for start_of_saturday.
 
long start_of_min (long ts)
 Get the start of the minute for a timestamp.
 
long min_begin (long ts)
 Alias for start_of_min.
 
long end_of_min (long ts)
 Get the end of the minute for a timestamp.
 
long finish_of_min (long ts)
 Alias for end_of_min.
 
int min_of_day (long ts)
 Get the minute of the day.
 
int min_of_hour (long ts)
 Get the minute of the hour.
 
int min_in_hour (long ts)
 Alias for min_of_hour.
 
long start_of_period (int p, long ts)
 Get the start of a period.
 
long end_of_period (int p, long ts)
 Get the end of a period.
 
long get_unix_day (long ts)
 Get UNIX day from timestamp.
 
long unix_day (long ts)
 Alias for get_unix_day.
 
long get_unixday (long ts)
 Alias for get_unix_day.
 
long unixday (long ts)
 Alias for get_unix_day.
 
long uday (long ts)
 Alias for get_unix_day.
 
int get_days_difference (long start, long stop)
 Get number of days between two timestamps.
 
int get_days (long start, long stop)
 Alias for get_days_difference.
 
int days (long start, long stop)
 Alias for get_days_difference.
 
long get_unix_day_ms (long ts_ms)
 Get UNIX day from milliseconds timestamp.
 
long unix_day_ms (long ts_ms)
 Alias for get_unix_day_ms.
 
long get_unixday_ms (long ts_ms)
 Alias for get_unix_day_ms.
 
long unixday_ms (long ts_ms)
 Alias for get_unix_day_ms.
 
long uday_ms (long ts_ms)
 Alias for get_unix_day_ms.
 
long unix_day_to_timestamp (long uday)
 Convert UNIX day to timestamp in seconds.
 
long unix_day_to_ts (long uday)
 Alias for unix_day_to_timestamp.
 
long unixday_to_ts (long uday)
 Alias for unix_day_to_timestamp.
 
long uday_to_ts (long uday)
 Alias for unix_day_to_timestamp.
 
long start_of_day_from_unix_day (long uday)
 Alias for unix_day_to_timestamp.
 
long unix_day_to_timestamp_ms (long uday)
 Convert UNIX day to timestamp in milliseconds.
 
long unix_day_to_ts_ms (long uday)
 Alias for unix_day_to_timestamp_ms.
 
long unixday_to_ts_ms (long uday)
 Alias for unix_day_to_timestamp_ms.
 
long uday_to_ts_ms (long uday)
 Alias for unix_day_to_timestamp_ms.
 
long start_of_day_from_unix_day_ms (long uday)
 Alias for unix_day_to_timestamp_ms.
 
long end_of_day_from_unix_day (long uday)
 Get end of day timestamp from UNIX day.
 
long end_of_day_from_unix_day_ms (long uday)
 Get end of day timestamp in ms from UNIX day.
 
long eod_from_unix_day (long uday)
 Alias for end_of_day_from_unix_day.
 
long eod_from_unix_day_ms (long uday)
 Alias for end_of_day_from_unix_day_ms.
 
long start_of_next_day_from_unix_day (long uday)
 Get start of next day timestamp from UNIX day.
 
long start_of_next_day_from_unix_day_ms (long uday)
 Get start of next day timestamp in ms from UNIX day.
 
long next_day_unix_day (long uday)
 Alias for start_of_next_day_from_unix_day.
 
long next_day_unixday (long uday)
 Alias for start_of_next_day_from_unix_day.
 
long next_day_unix_day_ms (long uday)
 Alias for start_of_next_day_from_unix_day_ms.
 
long next_day_unixday_ms (long uday)
 Alias for start_of_next_day_from_unix_day_ms.
 
long next_day_from_unix_day (long uday)
 Alias for start_of_next_day_from_unix_day.
 
long get_unix_min (long ts)
 Get UNIX minute from timestamp.
 
long unix_min (long ts)
 Alias for get_unix_min.
 
long to_unix_min (long ts)
 Alias for get_unix_min.
 
long umin (long ts)
 Alias for get_unix_min.
 
int sec_of_day (long ts)
 Get second of day from timestamp.
 
int sec_of_day_ms (long ts_ms)
 Get second of day from milliseconds timestamp.
 
int sec_of_day (int hour, int min, int sec)
 Get second of day from hours, minutes and seconds.
 
TimeZoneStruct to_time_zone (int offset)
 Convert an integer offset to a TimeZoneStruct.
 
TimeZoneStruct to_tz_struct (int offset)
 Alias for to_time_zone.
 
int get_month_number (string month)
 Get the month number by name.
 
int month_of_year (string month)
 Alias for get_month_number function.
 
bool try_get_month_number (string month, int &value)
 Get the month number by name, with output parameter.
 
bool get_month_number (string month, int &value)
 Alias for try_get_month_number function.
 
bool month_of_year (string month, int &value)
 Alias for try_get_month_number function.
 
bool parse_time_zone (string tz_str, TimeZoneStruct &tz)
 Parse a time zone string into a TimeZoneStruct.
 
bool parse_tz (string tz_str, TimeZoneStruct &tz)
 Alias for parse_time_zone function.
 
bool parse_iso8601 (string input_str, DateTimeStruct &dt, TimeZoneStruct &tz)
 Parse a date and time string in ISO8601 format.
 
bool str_to_ts (string str, long &ts)
 Convert an ISO8601 string to a timestamp (ts_t).
 
bool str_to_ts_ms (string str, long &ts)
 Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
 
bool str_to_fts (string str, double &ts)
 Convert an ISO8601 string to a floating-point timestamp (fts_t).
 
long ts (string str)
 Convert an ISO8601 string to a timestamp (ts_t).
 
long ts_ms (string str)
 Convert an ISO8601 string to a millisecond timestamp (ts_ms_t).
 
double fts (string str)
 Convert an ISO8601 string to a floating-point timestamp (fts_t).
 
int sec_of_day (string str)
 Convert string with time of day to second of day.
 
TimeStruct create_time_struct (const int hour, const int min, const int sec=0, const int ms=0)
 Creates a TimeStruct instance.
 
long microseconds ()
 Get the number of microseconds since the UNIX epoch.
 
long ns_of_sec ()
 Get the nanosecond part of the current second.
 
int us_of_sec ()
 Get the microsecond part of the current second.
 
int ms_of_sec ()
 Get the millisecond part of the current second.
 
datetime cet_to_gmt (const datetime cet)
 Convert Central European Time to Greenwich Mean Time.
 
datetime eet_to_gmt (const datetime eet)
 Convert Eastern European Time to Greenwich Mean Time.
 
TimeZoneStruct to_time_zone_struct (int offset)
 Converts an integer offset to a TimeZoneStruct.
 
TimeZoneStruct to_tz (int offset)
 Converts an integer offset to a TimeZoneStruct.
 
bool is_leap_year_date (const long year)
 Checks if the given year is a leap year.
 
bool check_leap_year (const long year)
 Alias for is_leap_year_date.
 
bool leap_year (const long year)
 Alias for is_leap_year_date.
 
bool is_leap_year_ts (const long ts)
 Checks if the year of the given timestamp is a leap year.
 
bool leap_year_ts (const long ts)
 Alias for is_leap_year_ts.
 
bool check_leap_year_ts (const long ts)
 Alias for is_leap_year_ts.
 
bool is_leap_year (const long ts)
 Alias for is_leap_year_ts.
 
bool is_valid_time_zone (const int hour, const int min)
 Check if the time zone components are valid.
 
bool is_valid_tz (const int hour, const int min)
 Alias for is_valid_time_zone.
 
bool is_valid_time_zone_offset (const TimeZoneStruct &time_zone)
 Check if the time zone structure is valid.
 
bool is_valid_time_zone (const TimeZoneStruct &time_zone)
 Alias for is_valid_time_zone_offset.
 
bool is_valid_tz (const TimeZoneStruct &time_zone)
 Alias for is_valid_time_zone_offset.
 
bool is_valid_time (const int hour, const int min, const int sec, const int ms=0)
 Checks the correctness of the specified time.
 
bool is_valid_time (const TimeStruct &time)
 Checks the correctness of the specified time structure.
 
bool is_valid_date (const long year, const int month, const int day)
 Checks the correctness of the specified date.
 
bool is_valid_date (const DateStruct &date)
 Checks the correctness of the specified date structure.
 
bool is_valid_date_time (const long year, const int month, const int day, const int hour=0, const int min=0, const int sec=0, const int ms=0)
 Checks the correctness of date and time components.
 
bool is_valid_date_time (const DateTimeStruct &date_time)
 Checks the correctness of the date-time structure.
 
bool is_day_off (const long ts)
 Check if a timestamp corresponds to a weekend day.
 
bool is_weekend (const long ts)
 Alias for is_day_off.
 
bool is_day_off_unix_day (const long unix_day)
 Check if a Unix day corresponds to a weekend day.
 
bool is_weekend_unix_day (const long unix_day)
 Alias for is_day_off_unix_day.
 
template<class T = year_t>
constexpr const T unix_year (ts_t ts) noexcept
 Alias for get_unix_year function.
 
template<class T = year_t>
constexpr const T to_unix_year (ts_t ts) noexcept
 Alias for get_unix_year function.
 
template<class T = uday_t>
constexpr T get_unixday (ts_t ts=time_shield::ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr T unix_day (ts_t ts=time_shield::ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr T unixday (ts_t ts=time_shield::ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr T uday (ts_t ts=time_shield::ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = uday_t>
constexpr T get_unixday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr T unix_day_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr T unixday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = uday_t>
constexpr T uday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for get_unix_day_ms function.
 
template<class T = ts_t>
constexpr const T unix_day_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T unixday_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T uday_to_ts (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T start_of_day_from_unix_day (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp function.
 
template<class T = ts_t>
constexpr const T unix_day_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T unixday_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T uday_to_ts_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T start_of_day_from_unix_day_ms (uday_t unix_day) noexcept
 Alias for unix_day_to_timestamp_ms function.
 
template<class T = ts_t>
constexpr const T next_day_from_unix_day (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr const T next_day_unix_day (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr const T next_day_unixday (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_ms_t>
constexpr const T next_day_from_unix_day_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr const T next_day_unix_day_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr const T next_day_unixday_ms (uday_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = int64_t>
constexpr const T unix_min (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T to_unix_min (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int64_t>
constexpr const T umin (ts_t ts=ts())
 Alias for get_unix_min function.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T h24_to_h12 (T hour) noexcept
 Alias for hour24_to_12 function.
 
template<class T1, class T2 = ts_t>
T1 to_dt (T2 ts)
 Alias for to_date_time function.
 
template<class T1, class T2 = ts_t>
T1 to_dt_struct (T2 ts)
 Alias for to_date_time function.
 
template<class T>
to_dt_ms (ts_ms_t ts)
 Alias for to_date_time_ms function.
 
template<class T>
to_dt_struct_ms (ts_ms_t ts)
 Alias for to_date_time_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t ts (year_t year, int month, int day)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t ts (year_t year, int month, int day, int hour)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t ts (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t ts (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_ts (year_t year, int month, int day)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_ts (year_t year, int month, int day, int hour)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_ts (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_ts (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_timestamp (year_t year, int month, int day)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_timestamp (year_t year, int month, int day, int hour)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_timestamp (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_timestamp (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t timestamp (year_t year, int month, int day)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t timestamp (year_t year, int month, int day, int hour)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t timestamp (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t timestamp (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts (year_t year, int month, int day)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts (year_t year, int month, int day, int hour)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_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.
 
constexpr ts_t ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t get_ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t get_timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t to_ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t ts_from_tm (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_t to_timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
constexpr ts_ms_t ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t ts_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t ts_ms (year_t year, int month, int day, int hour, int min, int sec, int ms)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_ts_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_ts_ms (year_t year, int month, int day, int hour, int min, int sec, int ms)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_timestamp_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour, int min, int sec, int ms)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t timestamp_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t timestamp_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t timestamp_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t timestamp_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t timestamp_ms (year_t year, int month, int day, int hour, int min, int sec, int ms)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t to_ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t to_ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t to_ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t to_ts_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
constexpr ts_ms_t to_ts_ms (year_t year, int month, int day, int hour, int min, int sec, int ms)
 Alias for to_timestamp_ms.
 
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 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>
constexpr fts_t to_fts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
constexpr fts_t fts (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
constexpr fts_t ftimestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Alias for to_ftimestamp.
 
template<class T>
constexpr fts_t to_ftimestamp (const T &date_time)
 Alias for dt_to_ftimestamp.
 
template<class T>
constexpr fts_t to_fts (const T &date_time)
 Alias for dt_to_ftimestamp.
 
template<class T>
constexpr fts_t fts (const T &date_time)
 Alias for dt_to_ftimestamp.
 
template<class T>
constexpr fts_t ftimestamp (const T &date_time)
 Alias for dt_to_ftimestamp.
 
constexpr fts_t to_ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
constexpr fts_t to_fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
constexpr fts_t fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
constexpr fts_t ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
template<class T = int>
constexpr const T get_days (ts_t start, ts_t stop) noexcept
 Alias for get_days_difference function.
 
template<class T = int>
constexpr const T days (ts_t start, ts_t stop) noexcept
 Alias for get_days_difference function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T year (ts_t ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T to_year (ts_t ts=ts())
 Alias for get_year function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T year_ms (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 (ts_ms_t ts_ms=ts_ms())
 Alias for get_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t year_start (ts_t ts=time_shield::ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_t year_begin (ts_t ts=time_shield::ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_t year_start_ms (ts_t ts_ms=time_shield::ts_ms())
 Alias for start_of_year_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t year_begin_ms (ts_t ts_ms=time_shield::ts_ms())
 Alias for start_of_year_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t year_start_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t year_begin_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t year_start_date_ms (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 (T year)
 Alias for start_of_year_date_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t year_end (ts_t ts=time_shield::ts())
 Alias for end_of_year function.
 
TIME_SHIELD_CONSTEXPR const ts_ms_t year_end_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for end_of_year_ms function.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
constexpr const T1 days_in_month (T2 year, T3 month) noexcept
 Alias for num_days_in_month function.
 
template<class T1 = int>
constexpr const T1 num_days_in_month (ts_t ts=time_shield::ts()) noexcept
 Alias for num_days_in_month_ts function.
 
template<class T1 = int>
constexpr const T1 days_in_month (ts_t ts=time_shield::ts()) noexcept
 Alias for num_days_in_month_ts function.
 
template<class T1 = int, class T2 = year_t>
constexpr const T1 days_in_year (T2 year) noexcept
 Alias for num_days_in_year function.
 
template<class T = int>
constexpr const T days_in_year_ts (ts_t ts=time_shield::ts())
 Alias for num_days_in_year_ts function.
 
constexpr const ts_t day_start (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_day function.
 
template<class T = int>
constexpr const ts_t previous_day_start (ts_t ts=time_shield::ts(), T days=1) noexcept
 Alias for start_of_prev_day function.
 
constexpr const ts_t day_start_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_day_sec function.
 
constexpr const ts_t start_day_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_day_sec function.
 
constexpr const ts_ms_t day_start_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_day_ms function.
 
template<class T = int>
constexpr const ts_t next_day_start (ts_t ts, T days=1) noexcept
 Alias for start_of_next_day function.
 
template<class T = int>
constexpr const ts_ms_t next_day_start_ms (ts_ms_t ts_ms, T days=1) noexcept
 Alias for start_of_next_day_ms function.
 
constexpr const ts_t day_end (const ts_t &ts=time_shield::ts()) noexcept
 Alias for end_of_day function.
 
constexpr const ts_t day_end_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_day_sec function.
 
constexpr const ts_ms_t day_end_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_day_ms function.
 
template<class T1 = Weekday>
constexpr const T1 day_of_week (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 day_of_week (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 get_weekday (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 get_weekday (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 weekday (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 weekday (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 dow (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr const T1 dow (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 get_dow (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 dow_from_date (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 weekday_of (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 day_of_week_dt (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 day_of_week (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 dow (const T2 &date)
 Alias for get_weekday_from_date.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr const T day_of_week (U ts) noexcept
 Alias for get_weekday_from_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr const T dow_ts (U ts) noexcept
 Alias for get_weekday_from_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr const T get_dow_from_ts (U ts) noexcept
 Alias for get_weekday_from_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr const T weekday_of_ts (U ts) noexcept
 Alias for get_weekday_from_ts.
 
template<class T = Weekday>
constexpr const T day_of_week_ms (ts_ms_t ts_ms)
 Alias for get_weekday_from_ts_ms function.
 
TIME_SHIELD_CONSTEXPR const ts_t month_begin (ts_t ts=time_shield::ts())
 Alias for start_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t last_day_of_month (ts_t ts=time_shield::ts())
 Alias for end_of_month function.
 
TIME_SHIELD_CONSTEXPR const ts_t final_sunday_of_month (ts_t ts=time_shield::ts())
 Alias for last_sunday_of_month function.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 final_sunday_month_day (T2 year, T3 month)
 Alias for last_sunday_month_day function.
 
constexpr const ts_t hour_begin (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_hour function.
 
constexpr const ts_t hour_begin_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_hour_sec function.
 
constexpr const ts_ms_t hour_begin_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_hour_ms function.
 
constexpr const ts_t finish_of_hour (ts_t ts=time_shield::ts()) noexcept
 Alias for end_of_hour function.
 
constexpr const ts_t finish_of_hour_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_hour_sec function.
 
constexpr const ts_ms_t finish_of_hour_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_hour_ms function.
 
template<class T = int>
constexpr const T hour_in_day (ts_t ts=time_shield::ts()) noexcept
 Alias for hour_of_day function.
 
constexpr const ts_t week_begin (ts_t ts=time_shield::ts())
 Alias for start_of_week function.
 
constexpr const ts_t finish_of_week (ts_t ts=time_shield::ts())
 Alias for end_of_week function.
 
constexpr const ts_t saturday_begin (ts_t ts=time_shield::ts())
 Alias for start_of_saturday function.
 
constexpr const ts_t min_begin (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_min function.
 
constexpr const ts_t finish_of_min (ts_t ts=time_shield::ts()) noexcept
 Alias for end_of_min function.
 
template<class T = int>
constexpr const T ns_of_sec (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 (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 (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 (ts_ms_t ts) noexcept
 Get the millisecond part of the timestamp.
 
template<class T>
constexpr ts_ms_t sec_to_ms_impl (T t, std::true_type tag) noexcept
 Helper function for converting seconds to milliseconds (floating-point version).
 
template<class T>
constexpr ts_ms_t sec_to_ms_impl (T t, std::false_type tag) noexcept
 Helper function for converting seconds to milliseconds (integral version).
 
template<class T1 = ts_ms_t, class T2>
constexpr T1 sec_to_ms (T2 ts) noexcept
 Converts a timestamp from seconds to milliseconds.
 
ts_ms_t fsec_to_ms (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 (T2 ts_ms) noexcept
 Converts a timestamp from milliseconds to seconds.
 
template<class T = ts_ms_t>
constexpr const fts_t ms_to_fsec (T ts_ms) noexcept
 Converts a timestamp from milliseconds to floating-point seconds.
 
template<class T>
constexpr ts_ms_t min_to_ms_impl (T t, std::true_type tag) noexcept
 Helper function for converting minutes to milliseconds (floating-point version).
 
template<class T>
constexpr ts_ms_t min_to_ms_impl (T t, std::false_type tag) noexcept
 Helper function for converting minutes to milliseconds (integral version).
 
template<class T1 = ts_ms_t, class T2>
constexpr T1 min_to_ms (T2 ts) noexcept
 Converts a timestamp from minutes to milliseconds.
 
template<class T1 = int, class T2 = ts_ms_t>
constexpr T1 ms_to_min (T2 ts) noexcept
 Converts a timestamp from milliseconds to minutes.
 
template<class T>
constexpr ts_t min_to_sec_impl (T t, std::true_type tag) noexcept
 Helper function for converting minutes to seconds (floating-point version).
 
template<class T>
constexpr ts_t min_to_sec_impl (T t, std::false_type tag) noexcept
 Helper function for converting minutes to seconds (integral version).
 
template<class T1 = ts_t, class T2>
constexpr T1 min_to_sec (T2 ts) noexcept
 Converts a timestamp from minutes to seconds.
 
template<class T1 = int, class T2 = ts_t>
constexpr T1 sec_to_min (T2 ts) noexcept
 Converts a timestamp from seconds to minutes.
 
template<class T = int>
constexpr fts_t min_to_fsec (T min) noexcept
 Converts a timestamp from minutes to floating-point seconds.
 
template<class T = ts_t>
constexpr double sec_to_fmin (T ts) noexcept
 Converts a timestamp from seconds to floating-point minutes.
 
template<class T>
constexpr ts_ms_t hour_to_ms_impl (T t, std::true_type tag) noexcept
 Helper function for converting hours to milliseconds (floating-point version).
 
template<class T>
constexpr ts_ms_t hour_to_ms_impl (T t, std::false_type tag) noexcept
 Helper function for converting hours to milliseconds (integral version).
 
template<class T1 = ts_ms_t, class T2>
constexpr T1 hour_to_ms (T2 ts) noexcept
 Converts a timestamp from hours to milliseconds.
 
template<class T1 = int, class T2 = ts_ms_t>
constexpr T1 ms_to_hour (T2 ts) noexcept
 Converts a timestamp from milliseconds to hours.
 
template<class T>
constexpr ts_t hour_to_sec_impl (T t, std::true_type tag) noexcept
 Helper function for converting hours to seconds (floating-point version).
 
template<class T>
constexpr ts_t hour_to_sec_impl (T t, std::false_type tag) noexcept
 Helper function for converting hours to seconds (integral version).
 
template<class T1 = ts_t, class T2>
constexpr T1 hour_to_sec (T2 ts) noexcept
 Converts a timestamp from hours to seconds.
 
template<class T1 = int, class T2 = ts_t>
constexpr T1 sec_to_hour (T2 ts) noexcept
 Converts a timestamp from seconds to hours.
 
template<class T = int>
constexpr fts_t hour_to_fsec (T hr) noexcept
 Converts a timestamp from hours to floating-point seconds.
 
template<class T = ts_t>
constexpr double sec_to_fhour (T ts) noexcept
 Converts a timestamp from seconds to floating-point hours.
 
template<class T = year_t>
constexpr const T get_unix_year (ts_t ts) noexcept
 Converts a UNIX timestamp to a year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T hour24_to_12 (T hour) noexcept
 Converts a 24-hour format hour to a 12-hour format.
 
template<class T1 = DateTimeStruct, class T2 = ts_t>
T1 to_date_time (T2 ts)
 Converts a timestamp to a date-time structure.
 
template<class T>
to_date_time_ms (ts_ms_t ts)
 Converts a timestamp in milliseconds to a date-time structure with milliseconds.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_t to_timestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0)
 Converts a date and time to a timestamp.
 
template<class T>
TIME_SHIELD_CONSTEXPR const ts_t dt_to_timestamp (const T &date_time)
 Converts a date-time structure to a timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_t tm_to_timestamp (const std::tm *timeinfo)
 Converts a std::tm structure to a timestamp.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR const ts_ms_t to_timestamp_ms (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T2 ms=0)
 Converts a date and time to a timestamp in milliseconds.
 
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.
 
TIME_SHIELD_CONSTEXPR const ts_t tm_to_timestamp_ms (const std::tm *timeinfo)
 Converts a std::tm structure to a timestamp in milliseconds.
 
template<class T1 = year_t, class T2 = int, class T3 = int>
TIME_SHIELD_CONSTEXPR const fts_t to_ftimestamp (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0)
 Converts a date and time to a floating-point timestamp.
 
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.
 
TIME_SHIELD_CONSTEXPR const fts_t tm_to_ftimestamp (const std::tm *timeinfo)
 Converts a std::tm structure to a floating-point timestamp.
 
template<class T = uday_t>
constexpr const T get_unix_day (ts_t ts=time_shield::ts()) noexcept
 Get UNIX day.
 
template<class T = int>
constexpr const T get_days_difference (ts_t start, ts_t stop) noexcept
 Get the number of days between two timestamps.
 
template<class T = uday_t>
constexpr const T get_unix_day_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Get UNIX day from milliseconds timestamp.
 
template<class T = ts_t>
constexpr const T unix_day_to_timestamp (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp in seconds.
 
template<class T = ts_t>
constexpr const T unix_day_to_timestamp_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp in milliseconds.
 
template<class T = ts_t>
constexpr const T end_of_day_from_unix_day (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the end of the day in seconds.
 
template<class T = ts_ms_t>
constexpr const T end_of_day_from_unix_day_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the end of the day in milliseconds.
 
template<class T = ts_ms_t>
constexpr const T start_of_next_day_from_unix_day (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the start of the next day in seconds.
 
template<class T = ts_ms_t>
constexpr const T start_of_next_day_from_unix_day_ms (uday_t unix_day) noexcept
 Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.
 
template<class T = int64_t>
constexpr const T get_unix_min (ts_t ts=ts())
 Get UNIX minute.
 
template<class T = int>
constexpr const T sec_of_day (ts_t ts=ts()) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr const T sec_of_day_ms (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 (T2 hour, T2 min, T2 sec) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr const T sec_of_min (ts_t ts=ts())
 Get the second of the minute.
 
template<class T = int>
constexpr const T sec_of_hour (ts_t ts=ts())
 Get the second of the hour.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T get_year (ts_t ts=ts())
 Get the year from the timestamp.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const T get_year_ms (ts_ms_t ts_ms=ts_ms())
 Get the year from the timestamp in milliseconds.
 
TIME_SHIELD_CONSTEXPR const ts_t start_of_year (ts_t ts) noexcept
 Get the start of the year timestamp.
 
TIME_SHIELD_CONSTEXPR const ts_ms_t start_of_year_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the start of the year timestamp in milliseconds.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_t start_of_year_date (T year)
 Get the timestamp of the start of the year.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t start_of_year_date_ms (T year)
 Get the timestamp in milliseconds of the start of the year.
 
TIME_SHIELD_CONSTEXPR ts_t end_of_year (ts_t ts=time_shield::ts())
 Get the end-of-year timestamp.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR const ts_ms_t end_of_year_ms (ts_ms_t ts_ms=ts_ms())
 Get the timestamp in milliseconds of the end of the year.
 
template<class T = int>
const T day_of_year (ts_t ts=time_shield::ts())
 Get the day of the year.
 
template<class T = Month>
TIME_SHIELD_CONSTEXPR const T month_of_year (ts_t ts) noexcept
 Get the month of the year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR const T day_of_month (ts_t ts=time_shield::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 (T2 year, T3 month) noexcept
 Get the number of days in a month.
 
template<class T1 = int>
TIME_SHIELD_CONSTEXPR const T1 num_days_in_month_ts (ts_t ts=time_shield::ts()) noexcept
 Get the number of days in the month of the given timestamp.
 
template<class T1 = int, class T2 = year_t>
constexpr const T1 num_days_in_year (T2 year) noexcept
 Get the number of days in a given year.
 
template<class T = int>
constexpr const T num_days_in_year_ts (ts_t ts=time_shield::ts())
 Get the number of days in the current year.
 
constexpr const ts_t start_of_day (ts_t ts=time_shield::ts()) noexcept
 Get the start of the day timestamp.
 
template<class T = int>
constexpr const ts_t start_of_prev_day (ts_t ts=time_shield::ts(), T days=1) noexcept
 Get timestamp of the start of the previous day.
 
constexpr const ts_t start_of_day_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the start of the day timestamp in seconds.
 
constexpr const ts_ms_t start_of_day_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the start of the day timestamp in milliseconds.
 
template<class T = int>
constexpr const ts_t start_of_next_day (ts_t ts, T days=1) noexcept
 Get the timestamp of the start of the day after a specified number of days.
 
template<class T = int>
constexpr const ts_ms_t start_of_next_day_ms (ts_ms_t ts_ms, T days=1) noexcept
 Get the timestamp of the start of the day after a specified number of days.
 
template<class T = int>
constexpr const ts_t next_day (ts_t ts, T days=1) noexcept
 Calculate the timestamp for a specified number of days in the future.
 
template<class T = int>
constexpr const ts_ms_t next_day_ms (ts_ms_t ts_ms, T days=1) noexcept
 Calculate the timestamp for a specified number of days in the future (milliseconds).
 
constexpr const ts_t end_of_day (const ts_t &ts=time_shield::ts()) noexcept
 Get the timestamp at the end of the day.
 
constexpr const ts_t end_of_day_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the end of the day in seconds.
 
constexpr const ts_ms_t end_of_day_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the end of the day in milliseconds.
 
template<class T1 = Weekday, class T2 = year_t, class T3 = int, class T4 = int>
constexpr const T1 day_of_week_date (T2 year, T3 month, T4 day)
 Get the day of the week.
 
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 T = Weekday>
constexpr const T get_weekday_from_ts (ts_t ts) noexcept
 Get the weekday from a timestamp.
 
template<class T = Weekday>
constexpr const T get_weekday_from_ts_ms (ts_ms_t ts_ms)
 Get the weekday from a timestamp in milliseconds.
 
TIME_SHIELD_CONSTEXPR const ts_t start_of_month (ts_t ts=time_shield::ts())
 Get the timestamp at the start of the current month.
 
TIME_SHIELD_CONSTEXPR const ts_t end_of_month (ts_t ts=time_shield::ts())
 Get the last timestamp of the current month.
 
TIME_SHIELD_CONSTEXPR ts_t last_sunday_of_month (ts_t ts=time_shield::ts())
 Get the timestamp of the last Sunday of the current month.
 
template<class T1 = int, class T2 = year_t, class T3 = int>
TIME_SHIELD_CONSTEXPR const T1 last_sunday_month_day (T2 year, T3 month)
 Get the day of the last Sunday of the given month and year.
 
constexpr const ts_t start_of_hour (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr const ts_t start_of_hour_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr const ts_ms_t start_of_hour_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the start of the hour. This function sets the minute and second to zero.
 
constexpr const ts_t end_of_hour (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp at the end of the hour. This function sets the minute and second to 59.
 
constexpr const ts_t end_of_hour_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the end of the hour.
 
constexpr const ts_ms_t end_of_hour_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Get the timestamp at the end of the hour.
 
template<class T = int>
constexpr const T hour_of_day (ts_t ts=time_shield::ts()) noexcept
 Get the hour of the day.
 
constexpr const ts_t start_of_week (ts_t ts=time_shield::ts())
 Get the timestamp of the beginning of the week.
 
constexpr const ts_t end_of_week (ts_t ts=time_shield::ts())
 Get the timestamp of the end of the week.
 
constexpr const ts_t start_of_saturday (ts_t ts=time_shield::ts())
 Get the timestamp of the start of Saturday.
 
constexpr const ts_t start_of_min (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp of the beginning of the minute.
 
constexpr const ts_t end_of_min (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp of the end of the minute.
 
template<class T = int>
constexpr const T min_of_day (ts_t ts=time_shield::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 (ts_t ts=time_shield::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 (T p, ts_t ts=time_shield::ts())
 Get the timestamp of the start of the period.
 
template<class T = int>
constexpr const ts_t end_of_period (T p, ts_t ts=time_shield::ts())
 Get the timestamp of the end of the period.
 
template<class T = TimeZoneStruct>
const T to_time_zone (tz_t offset)
 Converts an integer to a time zone structure.
 
void process_format_impl (char last_char, size_t repeat_count, ts_t ts, 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, T timestamp, 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, T timestamp, tz_t utc_offset=0)
 Alias for to_string function.
 
template<class T = ts_ms_t>
const std::string to_string_ms (const std::string &format_str, T timestamp, tz_t utc_offset=0)
 Convert timestamp in milliseconds to string with custom format.
 
template<class T = ts_t>
const std::string to_str_ms (const std::string &format_str, T timestamp, tz_t utc_offset=0)
 Alias for to_string function.
 
template<class T = ts_t>
const std::string to_iso8601 (T ts)
 Converts a timestamp to an ISO8601 string.
 
template<class T = ts_t>
const std::string to_iso8601_date (T ts)
 Converts a timestamp to an ISO8601 date string.
 
template<class T = ts_t>
const std::string to_iso8601_time (T ts)
 Converts a timestamp to an ISO8601 time string.
 
template<class T = ts_t>
const std::string to_iso8601_time_utc (T ts)
 Converts a timestamp to an ISO8601 UTC time string.
 
template<class T = ts_t>
const std::string to_iso8601_utc (T ts)
 Converts a timestamp to an ISO8601 string in UTC format.
 
const std::string to_iso8601_utc_ms (ts_ms_t ts_ms)
 Converts a timestamp in milliseconds to an ISO8601 string in UTC format.
 
const std::string to_iso8601_ms (ts_ms_t ts_ms)
 Converts a timestamp in milliseconds to an ISO8601 string.
 
template<class T = ts_t>
const std::string to_iso8601 (T ts, tz_t utc_offset)
 Converts a timestamp to an ISO8601 string with timezone offset.
 
const std::string to_iso8601_ms (ts_ms_t ts_ms, tz_t utc_offset)
 Converts a timestamp in milliseconds to an ISO8601 string with timezone offset.
 
const std::string to_mql5_date_time (ts_t ts)
 Converts a timestamp to a string in MQL5 date and time format.
 
const std::string to_mql5_full (ts_t ts)
 Alias for to_mql5_date_time_str function.
 
const std::string to_mql5_date (ts_t ts)
 Converts a timestamp to a string in MQL5 date format.
 
const std::string to_mql5_time (ts_t ts)
 Converts a timestamp to a string in MQL5 time format.
 
const std::string to_windows_filename (ts_t ts)
 Converts a timestamp in seconds to a Windows-compatible filename format.
 
const std::string to_windows_filename_ms (ts_ms_t ts)
 Converts a timestamp in milliseconds to a Windows-compatible filename format.
 
std::string to_human_readable (ts_t ts)
 Converts a timestamp in seconds to a human-readable format.
 
std::string to_human_readable_ms (ts_ms_t ts)
 Converts a timestamp in milliseconds to a human-readable format.
 
const ts_t cet_to_gmt (ts_t cet)
 Convert Central European Time to Greenwich Mean Time.
 
const ts_t eet_to_gmt (ts_t eet)
 Convert Eastern European Time to Greenwich Mean Time.
 
string pad_int (int value, int width)
 Internal helper to pad integer with leading zeros.
 
void process_format_impl (const char last_char, int repeat_count, long ts, int utc_offset, const DateTimeStruct &dt, string &result)
 Internal helper for custom formatting processing.
 
string to_string (string format_str, long timestamp, int utc_offset=0)
 Convert timestamp to string with custom format.
 
string to_str (string format_str, long timestamp, int utc_offset=0)
 Alias for to_string.
 
string to_string_ms (string format_str, long timestamp_ms, int utc_offset=0)
 Convert millisecond timestamp to string with custom format.
 
string to_str_ms (string format_str, long timestamp_ms, int utc_offset=0)
 Alias for to_string_ms.
 
string to_iso8601 (long ts)
 Convert timestamp to ISO8601 string.
 
string to_iso8601_ms (long ts_ms)
 Convert millisecond timestamp to ISO8601 string.
 
string to_iso8601_date (long ts)
 Convert timestamp to ISO8601 date string.
 
string to_iso8601_time (long ts)
 Convert timestamp to ISO8601 time string.
 
string to_iso8601_time_ms (long ts_ms)
 Convert millisecond timestamp to ISO8601 time string.
 
string to_iso8601_utc (long ts)
 Convert timestamp to ISO8601 string in UTC.
 
string to_iso8601_utc_ms (long ts_ms)
 Convert millisecond timestamp to ISO8601 string in UTC.
 
string to_iso8601 (long ts, int utc_offset)
 Convert timestamp to ISO8601 string with timezone offset.
 
string to_iso8601_ms (long ts_ms, int utc_offset)
 Convert millisecond timestamp to ISO8601 string with timezone offset.
 
string to_mql5_date_time (long ts)
 Convert timestamp to MQL5 date-time string.
 
string to_mql5_date (long ts)
 Convert timestamp to MQL5 date string.
 
string to_mql5_time (long ts)
 Convert timestamp to MQL5 time string.
 
string to_mql5_full (long ts)
 Alias for to_mql5_date_time.
 
string to_windows_filename (long ts)
 Convert timestamp to Windows-compatible filename.
 
string to_windows_filename_ms (long ts_ms)
 Convert millisecond timestamp to Windows-compatible filename.
 
string to_human_readable (long ts)
 Convert timestamp to human-readable string.
 
string to_human_readable_ms (long ts_ms)
 Convert millisecond timestamp to human-readable string.
 

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_1_SEC = 1000
 Milliseconds per 1 second.
 
constexpr int64_t MS_PER_5_SEC = 5000
 Milliseconds per 5 second.
 
constexpr int64_t MS_PER_10_SEC = 10000
 Milliseconds per 10 seconds.
 
constexpr int64_t MS_PER_15_SEC = 15000
 Milliseconds per 15 second.
 
constexpr int64_t MS_PER_30_SEC = 30000
 Milliseconds per 30 second.
 
constexpr int64_t MS_PER_MIN = 60000
 Milliseconds per minute.
 
constexpr int64_t MS_PER_1_MIN = 60000
 Milliseconds per 1 minute.
 
constexpr int64_t MS_PER_5_MIN = 300000
 Milliseconds per 5 minute.
 
constexpr int64_t MS_PER_10_MIN = 600000
 Milliseconds per 10 minute.
 
constexpr int64_t MS_PER_15_MIN = 900000
 Milliseconds per 15 minute.
 
constexpr int64_t MS_PER_30_MIN = 1800000
 Milliseconds per 30 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_1_HOUR = 3600000
 Milliseconds per 1 hour.
 
constexpr int64_t MS_PER_2_HOUR = 7200000
 Milliseconds per 2 hour.
 
constexpr int64_t MS_PER_4_HOUR = 14400000
 Milliseconds per 4 hour.
 
constexpr int64_t MS_PER_5_HOUR = 18000000
 Milliseconds per 5 hour.
 
constexpr int64_t MS_PER_8_HOUR = 28800000
 Milliseconds per 8 hour.
 
constexpr int64_t MS_PER_12_HOUR = 43200000
 Milliseconds per 12 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_1_MIN = 60
 Seconds per 1 minute.
 
constexpr int64_t SEC_PER_3_MIN = 180
 Seconds per 3 minute.
 
constexpr int64_t SEC_PER_5_MIN = 300
 Seconds per 5 minute.
 
constexpr int64_t SEC_PER_10_MIN = 600
 Seconds per 10 minute.
 
constexpr int64_t SEC_PER_15_MIN = 900
 Seconds per 15 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_1_HOUR = 3600
 Seconds per 1 hour.
 
constexpr int64_t SEC_PER_2_HOUR = 7200
 Seconds per 2 hour.
 
constexpr int64_t SEC_PER_4_HOUR = 14400
 Seconds per 4 hour.
 
constexpr int64_t SEC_PER_5_HOUR = 18000
 Seconds per 5 hour.
 
constexpr int64_t SEC_PER_8_HOUR = 28800
 Seconds per 8 hour.
 
constexpr int64_t SEC_PER_12_HOUR = 43200
 Seconds per 12 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_1_DAY = 1440
 Minutes per 1 day.
 
constexpr int64_t MIN_PER_2_DAY = 2*1440
 Minutes per 2 day.
 
constexpr int64_t MIN_PER_5_DAY = 5*1440
 Minutes per 5 day.
 
constexpr int64_t MIN_PER_7_DAY = 7*1440
 Minutes per 7 day.
 
constexpr int64_t MIN_PER_WEEK = 10080
 Minutes per week.
 
constexpr int64_t MIN_PER_10_DAY = 10*1440
 Minutes per 10 day.
 
constexpr int64_t MIN_PER_15_DAY = 15*1440
 Minutes per 15 day.
 
constexpr int64_t MIN_PER_30_DAY = 15*1440
 Minutes per 30 day.
 
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.
 
enum  FormatType {
  UPPERCASE_NAME = 0 , SHORT_NAME , FULL_NAME , 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 , 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 ,
  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 , 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 ,
  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 , 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...
 
string to_weekday_str (Weekday value, FormatType format=UPPERCASE_NAME)
 Converts a Weekday enum value to a string.
 
string to_month_str (Month value, FormatType format=UPPERCASE_NAME)
 Converts a Month enum value to a string.
 
string to_timezone_str (TimeZone value, FormatType format=UPPERCASE_NAME)
 Converts a TimeZone enum value to a string.
 

Detailed Description

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.

Function Documentation

◆ to_tz()

TimeZoneStruct time_shield::to_tz ( int offset)

Converts an integer offset to a TimeZoneStruct.

See also
to_time_zone_struct

Definition at line 68 of file time_zone_struct.mqh.