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

Namespaces

namespace  astronomy
 
namespace  detail
 
namespace  legacy
 
namespace  ntp
 

Classes

class  BasicPoolRunner
 Background runner that periodically measures NTP offsets using a pool. More...
 
class  CpuTickTimer
 Timer that measures CPU time ticks using get_cpu_time(). More...
 
struct  DateStruct
 Structure to represent a date. More...
 
class  DateTime
 Represents a moment in time with optional fixed UTC offset. More...
 
struct  DateTimeStruct
 Structure to represent date and time. More...
 
class  DeadlineTimer
 Helper that models a monotonic deadline for timeout management. More...
 
class  ElapsedTimer
 Helper that measures elapsed monotonic time spans. More...
 
struct  IsoWeekDateStruct
 Structure to represent an ISO week date. More...
 
struct  MoonPhaseSineCosine
 sin/cos helper for the Moon phase angle. More...
 
class  NtpClient
 NTP client for measuring time offset. More...
 
class  NtpClientPool
 
class  NtpClientPoolRunner
 
class  NtpClientPoolT
 Pool of NTP servers: rate-limited multi-server offset estimation. More...
 
struct  NtpPoolConfig
 Pool configuration. More...
 
struct  NtpSample
 NTP measurement sample (one server response). More...
 
struct  NtpServerConfig
 Per-server configuration. More...
 
class  NtpTimeService
 
class  NtpTimeServiceT
 Singleton service for background NTP measurements. More...
 
class  Timer
 Timer that mimics the behavior of Qt timers. More...
 
class  TimerScheduler
 Scheduler that manages timer execution. 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

using MoonPhaseCalculator = astronomy::MoonPhase
 Convenience alias for the geocentric Moon phase calculator.
 
using NtpClientPool = NtpClientPoolT<NtpClient>
 
using NtpClientPoolRunner = BasicPoolRunner<NtpClientPool>
 
using NtpTimeService = NtpTimeServiceT<detail::FakeNtpRunner>
 NTP time service alias that uses a fake runner for tests.
 
using timer_state_ptr = std::shared_ptr<detail::TimerState>
 
typedef int64_t year_t
 Year as an integer (e.g., 2024).
 
typedef int64_t dse_t
 Unix day count since 1970‑01‑01 (days since epoch).
 
using unix_day_t = dse_t
 Alias for Unix day count type.
 
using unixday_t = dse_t
 Alias for Unix day count type.
 
typedef int32_t iso_week_t
 ISO week number type (1-52/53).
 
typedef int32_t iso_weekday_t
 ISO weekday number type (1=Monday .. 7=Sunday).
 
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

jd_t fts_to_jd (fts_t ts) noexcept
 Convert Unix timestamp (floating seconds) to Julian Date (JD).
 
jd_t ts_to_jd (ts_t ts) noexcept
 Convert Unix timestamp (seconds) to Julian Date (JD).
 
jd_t gregorian_to_jd (double day, int64_t month, int64_t year) noexcept
 Convert Gregorian date (with optional fractional day) to Julian Date (JD).
 
jd_t gregorian_to_jd (uint32_t day, uint32_t month, uint32_t year, uint32_t hour, uint32_t minute, uint32_t second=0, uint32_t millisecond=0) noexcept
 Convert Gregorian date/time components to Julian Date (JD).
 
mjd_t fts_to_mjd (fts_t ts) noexcept
 Convert Unix timestamp (floating seconds) to Modified Julian Date (MJD).
 
mjd_t ts_to_mjd (ts_t ts) noexcept
 Convert Unix timestamp (seconds) to Modified Julian Date (MJD).
 
jdn_t gregorian_to_jdn (uint32_t day, uint32_t month, uint32_t year) noexcept
 Convert Gregorian date to Julian Day Number (JDN).
 
double moon_phase_jd_approx (fts_t ts) noexcept
 Get lunar phase in range [0..1) using a simple Julian Day approximation.
 
double moon_phase (fts_t ts) noexcept
 Get lunar phase in range [0..1) using the geocentric MoonPhase calculator.
 
MoonPhaseSineCosine moon_phase_sincos (fts_t ts) noexcept
 Get sin/cos of the lunar phase angle (continuous signal without wrap-around).
 
double moon_illumination (fts_t ts) noexcept
 Get illuminated fraction in range [0..1] using the geocentric MoonPhase calculator.
 
double moon_age_days_jd_approx (fts_t ts) noexcept
 Get lunar age in days (~0..29.53) using a simple Julian Day approximation.
 
double moon_age_days (fts_t ts) noexcept
 Get lunar age in days (~0..29.53).
 
astronomy::MoonQuarterInstants moon_quarters (fts_t ts) noexcept
 Quarter instants around the provided timestamp.
 
bool is_new_moon_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the new moon window (default \pm12h).
 
bool is_full_moon_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the full moon window (default \pm12h).
 
bool is_first_quarter_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the first quarter window (default \pm12h).
 
bool is_last_quarter_window (fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
 Check if timestamp falls into the last quarter window (default \pm12h).
 
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.
 
const IsoWeekDateStruct create_iso_week_date_struct (int64_t year, int32_t week=1, int32_t weekday=1)
 Creates an IsoWeekDateStruct instance.
 
TIME_SHIELD_CONSTEXPR oadate_t ts_to_oadate (ts_t ts) noexcept
 Convert Unix timestamp (seconds) to OA date.
 
TIME_SHIELD_CONSTEXPR oadate_t fts_to_oadate (fts_t ts) noexcept
 Convert Unix timestamp (floating seconds) to OA date.
 
TIME_SHIELD_CONSTEXPR oadate_t ts_ms_to_oadate (ts_ms_t ts_ms) noexcept
 Convert Unix timestamp (milliseconds) to OA date.
 
TIME_SHIELD_CONSTEXPR ts_t oadate_to_ts (oadate_t oa) noexcept
 Convert OA date to Unix timestamp (seconds).
 
TIME_SHIELD_CONSTEXPR fts_t oadate_to_fts (oadate_t oa) noexcept
 Convert OA date to Unix timestamp (floating seconds).
 
TIME_SHIELD_CONSTEXPR ts_ms_t oadate_to_ts_ms (oadate_t oa) noexcept
 Convert OA date to Unix timestamp (milliseconds).
 
template<class T1, class T2, class T3>
TIME_SHIELD_CONSTEXPR oadate_t to_oadate (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0, T3 ms=0) noexcept
 Build OA date from calendar components (Gregorian).
 
bool try_parse_month (const std::string &month, int &value)
 Try parse month name token into month index [1..12].
 
int parse_month (const std::string &month)
 Parse month name token into month index [1..12].
 
bool try_parse_month (std::string_view month, int &value)
 Try parse month name token into month index [1..12], string_view overload.
 
int parse_month (std::string_view month)
 Parse month name token into month index [1..12], string_view overload.
 
template<class T = Month>
parse_month_enum (const std::string &month)
 Parse month name token into Month enum (throwing).
 
template<class T = Month>
bool try_parse_month_enum (const std::string &month, T &value)
 Try parse month name token into Month enum (or any T).
 
template<class T = Month>
parse_month_enum (std::string_view month)
 Parse month name token into Month enum (throwing), string_view overload.
 
template<class T = Month>
bool try_parse_month_enum (std::string_view month, T &value)
 Try parse month name token into Month enum (or any T), string_view overload.
 
bool try_get_month_index (const std::string &month, int &value)
 Try parse month name token into month index [1..12].
 
int get_month_index (const std::string &month)
 Parse month name token into month index [1..12].
 
Month get_month_index_enum (const std::string &month)
 Parse month name token into Month enum.
 
bool try_get_month_index (std::string_view month, int &value)
 Try parse month name token into month index [1..12], string_view overload.
 
int get_month_index (std::string_view month)
 Parse month name token into month index [1..12], string_view overload.
 
Month get_month_index_enum (std::string_view month)
 Parse month name token into Month enum, string_view overload.
 
template<class T = Month>
get_month_number (const std::string &month)
 Get the month number by name (throwing).
 
template<class T = Month>
month_of_year (const std::string &month)
 Alias for get_month_number (throwing).
 
template<class T = Month>
bool try_get_month_number (const std::string &month, T &value)
 Try 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 (output parameter).
 
template<class T = Month>
bool month_of_year (const std::string &month, T &value)
 Alias for try_get_month_number (output parameter).
 
template<class T = Month>
get_month_number (std::string_view month)
 Get the month number by name (throwing), string_view overload.
 
template<class T = Month>
month_of_year (std::string_view month)
 Alias for get_month_number (throwing), string_view overload.
 
template<class T = Month>
bool try_get_month_number (std::string_view month, T &value)
 Try get the month number by name, string_view overload.
 
template<class T = Month>
bool get_month_number (std::string_view month, T &value)
 Alias for try_get_month_number, string_view overload.
 
template<class T = Month>
bool month_of_year (std::string_view month, T &value)
 Alias for try_get_month_number, string_view overload.
 
template<class T = Month>
get_month_number (const char *month)
 Get the month number by name (throwing), const char* overload.
 
template<class T = Month>
bool try_get_month_number (const char *month, T &value)
 Try get the month number by name, const char* overload.
 
template<class T = Month>
month_of_year (const char *month)
 Alias for get_month_number (throwing), const char* overload.
 
template<class T = Month>
bool get_month_number (const char *month, T &value)
 Alias for try_get_month_number (output parameter), const char* overload.
 
template<class T = Month>
bool month_of_year (const char *month, T &value)
 Alias for try_get_month_number (output parameter), const char* overload.
 
bool parse_time_zone (const char *data, std::size_t length, TimeZoneStruct &tz) noexcept
 Parse timezone character buffer into TimeZoneStruct.
 
bool parse_time_zone (const std::string &tz_str, TimeZoneStruct &tz) noexcept
 Parse timezone string into TimeZoneStruct.
 
bool parse_tz (const std::string &tz_str, TimeZoneStruct &tz) noexcept
 Alias for parse_time_zone.
 
bool parse_tz (const char *data, std::size_t length, TimeZoneStruct &tz) noexcept
 Alias for parse_time_zone (buffer overload).
 
bool parse_iso8601 (const char *input, std::size_t length, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept
 Parse ISO8601 character buffer into DateTimeStruct and TimeZoneStruct.
 
bool parse_iso8601 (const std::string &input, DateTimeStruct &dt, TimeZoneStruct &tz) noexcept
 Parse ISO8601 string into DateTimeStruct and TimeZoneStruct.
 
bool str_to_ts (const std::string &str, ts_t &ts)
 Convert an ISO8601 string to a timestamp (ts_t).
 
bool str_to_ts (const char *data, std::size_t length, ts_t &ts)
 Parse ISO8601 character buffer and convert to timestamp (seconds).
 
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_ts_ms (const char *data, std::size_t length, ts_ms_t &ts)
 Convert ISO8601 character buffer to 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).
 
bool str_to_fts (const char *data, std::size_t length, fts_t &ts)
 Convert ISO8601 character buffer to floating-point timestamp (fts_t).
 
bool is_workday (const std::string &str)
 Parse ISO8601 string and check if it falls on a workday (seconds precision).
 
bool is_workday_ms (const std::string &str)
 Parse ISO8601 string and check if it falls on a workday (milliseconds precision).
 
bool workday (const std::string &str)
 Alias for is_workday(const std::string&).
 
bool workday_ms (const std::string &str)
 Alias for is_workday_ms(const std::string&).
 
bool is_first_workday_of_month (const std::string &str)
 Parse ISO8601 string and check if it is the first workday of its month (seconds).
 
bool is_first_workday_of_month_ms (const std::string &str)
 Parse an ISO8601 string and check if it is the first workday of its month (millisecond precision).
 
bool is_last_workday_of_month (const std::string &str)
 Parse an ISO8601 string and check if it is the last workday of its month (seconds).
 
bool is_last_workday_of_month_ms (const std::string &str)
 Parse an ISO8601 string and check if it is the last workday of its month (millisecond).
 
bool is_within_first_workdays_of_month (const std::string &str, int count)
 Parse an ISO8601 string and check if it falls within the first N workdays of its month.
 
bool is_within_first_workdays_of_month_ms (const std::string &str, int count)
 Parse an ISO8601 string and check if it falls within the first N workdays of its month (millisecond precision).
 
bool is_within_last_workdays_of_month (const std::string &str, int count)
 Parse ISO8601 string and check if it is within last N workdays of its month (seconds).
 
bool is_within_last_workdays_of_month_ms (const std::string &str, int count)
 Parse ISO8601 string and check if it is within last N workdays of its month (milliseconds).
 
ts_t ts (const char *str)
 Convert ISO8601 C-string to timestamp (seconds).
 
ts_t ts (const char *data, std::size_t length)
 Convert ISO8601 character buffer to timestamp (seconds).
 
ts_ms_t ts_ms (const char *str)
 Convert ISO8601 C-string to timestamp (milliseconds).
 
ts_ms_t ts_ms (const char *data, std::size_t length)
 Convert ISO8601 character buffer to timestamp (milliseconds).
 
fts_t fts (const char *str)
 Convert ISO8601 C-string to floating timestamp (seconds).
 
fts_t fts (const char *data, std::size_t length)
 Convert ISO8601 character buffer to floating timestamp (seconds).
 
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.
 
const TimeStruct create_time_struct (int16_t hour, int16_t min, int16_t sec=0, int16_t ms=0)
 Creates a TimeStruct instance.
 
struct timespec get_timespec_impl () noexcept
 Get the current timespec.
 
int64_t now_realtime_us ()
 Get current real time in microseconds using a platform-specific method.
 
template<class T = int>
ns_of_sec () noexcept
 Get the nanosecond part of the current second.
 
template<class T = int>
us_of_sec () noexcept
 Get the microsecond part of the current second.
 
template<class T = int>
ms_of_sec () noexcept
 Get the millisecond part of the current second.
 
ts_t ts () noexcept
 Get the current UTC timestamp in seconds.
 
ts_t timestamp () noexcept
 Get the current UTC timestamp in seconds.
 
fts_t fts () noexcept
 Get the current UTC timestamp in floating-point seconds.
 
fts_t ftimestamp () noexcept
 Get the current UTC timestamp in floating-point seconds.
 
ts_ms_t ts_ms () noexcept
 Get the current UTC timestamp in milliseconds.
 
ts_ms_t timestamp_ms () noexcept
 Get the current UTC timestamp in milliseconds.
 
ts_ms_t now () noexcept
 Get the current UTC timestamp in milliseconds.
 
ts_us_t ts_us () noexcept
 Get the current UTC timestamp in microseconds.
 
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.
 
TimeZoneStruct create_time_zone_struct (int hour, int min, bool is_positive=true)
 Creates a TimeZoneStruct instance.
 
TimeZoneStruct to_time_zone_struct (tz_t offset)
 Converts an integer to a TimeZoneStruct.
 
TimeZoneStruct to_tz (tz_t offset)
 Alias for to_time_zone_struct function.
 
std::string time_zone_struct_to_string (const TimeZoneStruct &tz)
 Converts a TimeZoneStruct to a string representation.
 
std::string to_string (const TimeZoneStruct &tz)
 Alias for time_zone_struct_to_string function.
 
std::string to_str (const TimeZoneStruct &tz)
 Alias for time_zone_struct_to_string function.
 
TIME_SHIELD_CONSTEXPR tz_t time_zone_struct_to_offset (const TimeZoneStruct &tz) noexcept
 Convert a TimeZoneStruct to a numeric UTC offset (seconds).
 
TIME_SHIELD_CONSTEXPR tz_t tz_to_offset (const TimeZoneStruct &tz) noexcept
 Alias for time_zone_struct_to_offset.
 
TIME_SHIELD_CONSTEXPR tz_t to_offset (const TimeZoneStruct &tz) noexcept
 Alias for time_zone_struct_to_offset.
 
template<class T = year_t>
constexpr bool is_leap_year_date (T year) noexcept
 Checks if the given year is a leap year.
 
template<class T = year_t>
constexpr bool check_leap_year (T year) noexcept
 Alias for is_leap_year_date function.
 
template<class T = year_t>
constexpr 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 = dse_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 = dse_t>
TIME_SHIELD_CONSTEXPR bool is_weekend_unix_day (T unix_day) noexcept
 Alias for is_day_off_unix_day function.
 
TIME_SHIELD_CONSTEXPR bool is_workday (ts_t ts) noexcept
 Check if a given timestamp corresponds to a workday (Monday to Friday).
 
TIME_SHIELD_CONSTEXPR bool is_workday_ms (ts_ms_t ts_ms) noexcept
 Check if a given timestamp in milliseconds corresponds to a workday (Monday to Friday).
 
TIME_SHIELD_CONSTEXPR bool is_workday (year_t year, int month, int day) noexcept
 Check if a calendar date corresponds to a workday (Monday to Friday).
 
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 first_workday_day (long year, int month)
 
int last_workday_day (long year, int month)
 
int count_workdays_in_month (long year, int month)
 
long start_of_first_workday_month (long year, int month)
 Get start timestamp of the first workday of a month.
 
long start_of_first_workday_month_ms (long year, int month)
 Get start timestamp in milliseconds of the first workday of a month.
 
long start_of_first_workday_month (long ts)
 Get start timestamp of the first workday of the month containing timestamp.
 
long start_of_first_workday_month_ms (long ts_ms)
 Get start timestamp in milliseconds of the first workday of the month containing timestamp.
 
long end_of_first_workday_month (long year, int month)
 Get end timestamp of the first workday of a month.
 
long end_of_first_workday_month_ms (long year, int month)
 Get end timestamp in milliseconds of the first workday of a month.
 
long end_of_first_workday_month (long ts)
 Get end timestamp of the first workday of the month containing timestamp.
 
long end_of_first_workday_month_ms (long ts_ms)
 Get end timestamp in milliseconds of the first workday of the month containing timestamp.
 
long start_of_last_workday_month (long year, int month)
 Get start timestamp of the last workday of a month.
 
long start_of_last_workday_month_ms (long year, int month)
 Get start timestamp in milliseconds of the last workday of a month.
 
long start_of_last_workday_month (long ts)
 Get start timestamp of the last workday of the month containing timestamp.
 
long start_of_last_workday_month_ms (long ts_ms)
 Get start timestamp in milliseconds of the last workday of the month containing timestamp.
 
long end_of_last_workday_month (long year, int month)
 Get end timestamp of the last workday of a month.
 
long end_of_last_workday_month_ms (long year, int month)
 Get end timestamp in milliseconds of the last workday of a month.
 
long end_of_last_workday_month (long ts)
 Get end timestamp of the last workday of the month containing timestamp.
 
long end_of_last_workday_month_ms (long ts_ms)
 Get end timestamp in milliseconds of the last workday of the month containing timestamp.
 
int workday_index_in_month (long year, int month, int day)
 
bool is_first_workday_of_month (long year, int month, int day)
 
bool is_within_first_workdays_of_month (long year, int month, int day, int count)
 
bool is_last_workday_of_month (long year, int month, int day)
 
bool is_within_last_workdays_of_month (long year, int month, int day, int count)
 
bool is_first_workday_of_month (const long ts)
 
bool is_within_first_workdays_of_month (const long ts, int count)
 
bool is_last_workday_of_month (const long ts)
 
bool is_within_last_workdays_of_month (const long ts, int count)
 
bool is_first_workday_of_month_ms (const long ts_ms)
 
bool is_within_first_workdays_of_month_ms (const long ts_ms, int count)
 
bool is_last_workday_of_month_ms (const long ts_ms)
 
bool is_within_last_workdays_of_month_ms (const long ts_ms, int count)
 
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 date_to_unix_day (const long year, const int month, const int day)
 Convert calendar date to UNIX day.
 
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 is_workday (string str)
 Parse ISO8601 string and check for workday using second precision.
 
bool workday (string str)
 Alias for is_workday.
 
bool is_workday_ms (string str)
 Parse ISO8601 string and check for workday using millisecond precision.
 
bool workday_ms (string str)
 Alias for is_workday_ms.
 
bool is_first_workday_of_month (string str)
 Parse ISO8601 string and check for the first workday of the month using second precision.
 
bool is_first_workday_of_month_ms (string str)
 Parse ISO8601 string and check for the first workday of the month using millisecond precision.
 
bool is_within_first_workdays_of_month (string str, int count)
 Parse ISO8601 string and check if it falls within the first N workdays of the month using second precision.
 
bool is_within_first_workdays_of_month_ms (string str, int count)
 Parse ISO8601 string and check if it falls within the first N workdays of the month using millisecond precision.
 
bool is_last_workday_of_month (string str)
 Parse ISO8601 string and check for the last workday of the month using second precision.
 
bool is_last_workday_of_month_ms (string str)
 Parse ISO8601 string and check for the last workday of the month using millisecond precision.
 
bool is_within_last_workdays_of_month (string str, int count)
 Parse ISO8601 string and check if it falls within the last N workdays of the month using second precision.
 
bool is_within_last_workdays_of_month_ms (string str, int count)
 Parse ISO8601 string and check if it falls within the last N workdays of the month using millisecond precision.
 
long start_of_first_workday_month (string str)
 Parse ISO8601 string and return start of the first workday of that month in seconds.
 
long start_of_first_workday_month_ms (string str)
 Parse ISO8601 string and return start of the first workday of that month in milliseconds.
 
long end_of_first_workday_month (string str)
 Parse ISO8601 string and return end of the first workday of that month in seconds.
 
long end_of_first_workday_month_ms (string str)
 Parse ISO8601 string and return end of the first workday of that month in milliseconds.
 
long start_of_last_workday_month (string str)
 Parse ISO8601 string and return start of the last workday of that month in seconds.
 
long start_of_last_workday_month_ms (string str)
 Parse ISO8601 string and return start of the last workday of that month in milliseconds.
 
long end_of_last_workday_month (string str)
 Parse ISO8601 string and return end of the last workday of that month in seconds.
 
long end_of_last_workday_month_ms (string str)
 Parse ISO8601 string and return end of the last workday of that month in milliseconds.
 
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.
 
bool is_workday (const long ts)
 Check if the timestamp corresponds to a workday.
 
bool workday (const long ts)
 Alias for is_workday.
 
bool is_workday_ms (const long ts_ms)
 Check if the millisecond timestamp corresponds to a workday.
 
bool workday_ms (const long ts_ms)
 Alias for is_workday_ms.
 
bool is_workday (const long year, const int month, const int day)
 Check if the provided date represents a workday.
 
bool workday (const long year, const int month, const int day)
 Alias for is_workday.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T year_of (ts_t ts=time_shield::ts())
 Get the year from the timestamp.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T year_of_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Get the year from the timestamp in milliseconds.
 
template<class T1 = int, class T2 = year_t>
TIME_SHIELD_CONSTEXPR T1 num_days_in_year (T2 year) noexcept
 Get the number of days in a year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T num_days_in_year_ts (ts_t ts=time_shield::ts())
 Get the number of days in the current year.
 
template<class T1 = Weekday, class T2 = year_t, class T3 = int, class T4 = int>
TIME_SHIELD_CONSTEXPR T1 day_of_week_date (T2 year, T3 month, T4 day)
 Get the day of the week.
 
template<class T1 = Weekday, class T2>
TIME_SHIELD_CONSTEXPR T1 weekday_of_date (const T2 &date)
 Get the day of the week from a date structure.
 
template<class T1 = Weekday, class T2>
TIME_SHIELD_CONSTEXPR T1 weekday_from_date (const T2 &date)
 Alias for weekday_of_date.
 
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 ts_t to_timestamp_unchecked (T1 year, T2 month, T2 day, T2 hour=0, T2 min=0, T2 sec=0) noexcept
 Converts a date and time to a timestamp without validation.
 
template<class T1 = year_t, class T2 = int>
TIME_SHIELD_CONSTEXPR 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 ts_t dt_to_timestamp (const T &date_time)
 Converts a date-time structure to a timestamp.
 
TIME_SHIELD_CONSTEXPR 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 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-time structure to a timestamp in milliseconds.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_ms_t dt_to_timestamp_ms (const T &date_time)
 Converts a date-time structure to a timestamp in milliseconds.
 
TIME_SHIELD_CONSTEXPR 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 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 fts_t dt_to_ftimestamp (const T &date_time)
 Converts a date-time structure to a floating-point timestamp.
 
TIME_SHIELD_CONSTEXPR fts_t tm_to_ftimestamp (const std::tm *timeinfo)
 Converts a std::tm structure to a floating-point timestamp.
 
constexpr ts_t start_of_day (ts_t ts=time_shield::ts()) noexcept
 Get the start of the day timestamp.
 
template<class T = int>
constexpr 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 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 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 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 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 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 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 ts_t end_of_day (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp at the end of the day.
 
constexpr 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 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 T = year_t>
TIME_SHIELD_CONSTEXPR 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 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 start_of_year (ts_t ts) noexcept
 Get the start of the year timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_year_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Get the timestamp at the start of the year in milliseconds.
 
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 ts_ms_t end_of_year_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Get the timestamp in milliseconds of the end of the year.
 
template<class T = int>
day_of_year (ts_t ts=time_shield::ts())
 Get the day of the year.
 
template<class T = Month>
TIME_SHIELD_CONSTEXPR T month_of_year (ts_t ts) noexcept
 Get the month of the year.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR 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>
TIME_SHIELD_CONSTEXPR 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 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 T = Weekday>
constexpr T weekday_of_ts (ts_t ts) noexcept
 Get the second of the week day from a timestamp.
 
template<class T = Weekday>
constexpr T weekday_of_ts_ms (ts_ms_t ts_ms)
 Get the weekday from a timestamp in milliseconds.
 
template<class T = Weekday>
constexpr T get_weekday_from_ts (ts_t ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday>
constexpr T get_weekday_from_ts_ms (ts_ms_t ts_ms)
 Alias for weekday_of_ts_ms.
 
TIME_SHIELD_CONSTEXPR ts_t start_of_month (ts_t ts=time_shield::ts())
 Get the timestamp at the start of the current month.
 
TIME_SHIELD_CONSTEXPR 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 T1 last_sunday_month_day (T2 year, T3 month)
 Get the day of the last Sunday of the given month and year.
 
constexpr ts_t start_of_week (ts_t ts=time_shield::ts())
 Get the timestamp of the beginning of the week.
 
constexpr ts_t end_of_week (ts_t ts=time_shield::ts())
 Get the timestamp of the end of the week.
 
constexpr ts_t start_of_saturday (ts_t ts=time_shield::ts())
 Get the timestamp of the start of Saturday.
 
constexpr ts_t start_of_hour (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp at the start of the hour.
 
constexpr 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 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 ts_t end_of_hour (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp at the end of the hour.
 
constexpr 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 in seconds.
 
constexpr 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 in milliseconds.
 
constexpr ts_t start_of_min (ts_t ts=time_shield::ts()) noexcept
 Get the timestamp of the beginning of the minute.
 
constexpr 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 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 T hour_of_day (ts_t ts=time_shield::ts()) noexcept
 Get hour of day. This function returns a value between 0 to 23.
 
template<class T = int>
constexpr 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 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 ts_t end_of_period (T p, ts_t ts=time_shield::ts())
 Get the timestamp of the end of the period.
 
TIME_SHIELD_CONSTEXPR int iso_weekday_from_weekday (Weekday weekday) noexcept
 Convert Weekday enum to ISO weekday (Mon=1 .. Sun=7).
 
template<class Y = year_t, class M = Month, class D = int>
TIME_SHIELD_CONSTEXPR int iso_weekday_of_date (Y year, M month, D day)
 Get ISO weekday for a calendar date.
 
template<class Y = year_t, class M = Month, class D = int>
IsoWeekDateStruct to_iso_week_date (Y year, M month, D day)
 Convert calendar date to ISO week date.
 
IsoWeekDateStruct to_iso_week_date (const DateStruct &date)
 Convert DateStruct to ISO week date.
 
template<class T = ts_t>
IsoWeekDateStruct to_iso_week_date (T ts)
 Convert timestamp to ISO week date.
 
int iso_weeks_in_year (year_t iso_year)
 Calculate number of ISO weeks in a year.
 
bool is_valid_iso_week_date (year_t iso_year, int week, int weekday)
 Validate ISO week date components.
 
DateStruct iso_week_date_to_date (const IsoWeekDateStruct &iso_date)
 Convert ISO week date to calendar date.
 
std::string format_iso_week_date (const IsoWeekDateStruct &iso_date, bool extended=true, bool include_weekday=true)
 Format ISO week date to string.
 
bool parse_iso_week_date (const char *input, std::size_t length, IsoWeekDateStruct &iso_date) noexcept
 Parse ISO week date string buffer.
 
bool parse_iso_week_date (const std::string &input, IsoWeekDateStruct &iso_date) noexcept
 Parse ISO week date string.
 
bool try_parse_iso_week_date (const char *input, std::size_t length, IsoWeekDateStruct &iso_date) noexcept
 Alias for parse_iso_week_date.
 
bool try_parse_iso_week_date (const std::string &input, IsoWeekDateStruct &iso_date) noexcept
 Alias for parse_iso_week_date, std::string overload.
 
template<class T = year_t>
constexpr T unix_year (ts_t ts) noexcept
 Alias for years_since_epoch function.
 
template<class T = year_t>
constexpr T to_unix_year (ts_t ts) noexcept
 Alias for years_since_epoch function.
 
template<class T = year_t>
constexpr T get_unix_year (ts_t ts) noexcept
 Alias for years_since_epoch function.
 
template<class T = dse_t>
constexpr T get_unixday (ts_t ts=time_shield::ts()) noexcept
 Alias for get_unix_day function.
 
template<class T = dse_t>
constexpr T unix_day (ts_t ts=time_shield::ts()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T unixday (ts_t ts=time_shield::ts()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T uday (ts_t ts=time_shield::ts()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T get_unix_day (ts_t ts=time_shield::ts()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T get_unixday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T unix_day_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T unixday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T uday_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for days_since_epoch function.
 
template<class T = dse_t>
constexpr T get_unix_day_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Alias for days_since_epoch function.
 
template<class T = ts_t>
constexpr T unix_day_to_timestamp (dse_t unix_day) noexcept
 Alias for unix_day_to_ts function.
 
template<class T = ts_t>
constexpr T unixday_to_ts (dse_t unix_day) noexcept
 Alias for unix_day_to_ts function.
 
template<class T = ts_t>
constexpr T uday_to_ts (dse_t unix_day) noexcept
 Alias for unix_day_to_ts function.
 
template<class T = ts_t>
constexpr T start_of_day_from_unix_day (dse_t unix_day) noexcept
 Alias for unix_day_to_ts function.
 
template<class T = ts_t>
constexpr T unix_day_to_timestamp_ms (dse_t unix_day) noexcept
 Alias for unix_day_to_ts_ms function.
 
template<class T = ts_t>
constexpr T unixday_to_ts_ms (dse_t unix_day) noexcept
 Alias for unix_day_to_ts_ms function.
 
template<class T = ts_t>
constexpr T uday_to_ts_ms (dse_t unix_day) noexcept
 Alias for unix_day_to_ts_ms function.
 
template<class T = ts_t>
constexpr T start_of_day_from_unix_day_ms (dse_t unix_day) noexcept
 Alias for unix_day_to_ts_ms function.
 
template<class T = ts_t>
constexpr T next_day_from_unix_day (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr T next_day_unix_day (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_t>
constexpr T next_day_unixday (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day function.
 
template<class T = ts_ms_t>
constexpr T next_day_from_unix_day_ms (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr T next_day_unix_day_ms (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = ts_ms_t>
constexpr T next_day_unixday_ms (dse_t unix_day) noexcept
 Alias for start_of_next_day_from_unix_day_ms function.
 
template<class T = int64_t>
constexpr T minutes_since_epoch (ts_t ts=time_shield::ts())
 Alias for min_since_epoch function.
 
template<class T = int64_t>
constexpr T unix_min (ts_t ts=time_shield::ts())
 Alias for min_since_epoch function.
 
template<class T = int64_t>
constexpr T to_unix_min (ts_t ts=time_shield::ts())
 Alias for min_since_epoch function.
 
template<class T = int64_t>
constexpr T umin (ts_t ts=time_shield::ts())
 Alias for min_since_epoch function.
 
template<class T = int64_t>
constexpr T get_unix_min (ts_t ts=time_shield::ts())
 Alias for min_since_epoch function.
 
template<class T>
TIME_SHIELD_CONSTEXPR auto dt_to_ts (const T &date_time) -> decltype(dt_to_timestamp(date_time))
 Alias for dt_to_timestamp.
 
TIME_SHIELD_CONSTEXPR auto tm_to_ts (const std::tm *timeinfo) -> decltype(tm_to_timestamp(timeinfo))
 Alias for tm_to_timestamp.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR 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.
 
auto to_dt (ts_t ts) -> decltype(to_date_time(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.
 
auto to_dt_ms (ts_ms_t ts_ms) -> decltype(to_date_time_ms< DateTimeStruct >(ts_ms))
 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 ts_t to_timestamp (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t to_ts (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t ts (const T &date_time)
 Alias for dt_to_timestamp function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t timestamp (const T &date_time)
 Alias for dt_to_timestamp function.
 
TIME_SHIELD_CONSTEXPR ts_t ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t get_timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t ts_from_tm (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t to_timestamp (const std::tm *timeinfo)
 Alias for tm_to_timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t ts_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_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.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_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.
 
TIME_SHIELD_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.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_timestamp_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t get_timestamp_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_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.
 
TIME_SHIELD_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.
 
TIME_SHIELD_CONSTEXPR ts_ms_t timestamp_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t timestamp_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t timestamp_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t timestamp_ms (year_t year, int month, int day, int hour, int min, int sec)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_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.
 
TIME_SHIELD_CONSTEXPR ts_ms_t to_ts_ms (year_t year, int month, int day)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t to_ts_ms (year_t year, int month, int day, int hour)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_CONSTEXPR ts_ms_t to_ts_ms (year_t year, int month, int day, int hour, int min)
 Alias for to_timestamp_ms.
 
TIME_SHIELD_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.
 
TIME_SHIELD_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 ts_t to_timestamp_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T>
TIME_SHIELD_CONSTEXPR auto dt_to_ts_ms (const T &date_time) -> decltype(dt_to_timestamp_ms(date_time))
 Alias for dt_to_timestamp_ms function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t to_ts_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t ts_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
template<class T>
TIME_SHIELD_CONSTEXPR ts_t timestamp_ms (const T &date_time)
 Alias for dt_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t to_timestamp_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR auto tm_to_ts_ms (const std::tm *timeinfo) -> decltype(tm_to_timestamp_ms(timeinfo))
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t to_ts_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t ts_ms (const std::tm *timeinfo)
 Alias for tm_to_timestamp_ms function.
 
TIME_SHIELD_CONSTEXPR 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 auto dt_to_fts (const T &date_time) -> decltype(dt_to_ftimestamp(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.
 
TIME_SHIELD_CONSTEXPR fts_t to_ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
TIME_SHIELD_CONSTEXPR auto tm_to_fts (const std::tm *timeinfo) -> decltype(tm_to_ftimestamp(timeinfo))
 Alias for tm_to_ftimestamp.
 
TIME_SHIELD_CONSTEXPR fts_t to_fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
TIME_SHIELD_CONSTEXPR fts_t fts (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
TIME_SHIELD_CONSTEXPR fts_t ftimestamp (const std::tm *timeinfo)
 Alias for tm_to_ftimestamp.
 
template<class T = int>
constexpr T get_days (ts_t start, ts_t stop) noexcept
 Alias for days_between function.
 
template<class T = int>
constexpr T days (ts_t start, ts_t stop) noexcept
 Alias for days_between function.
 
template<class T = int>
constexpr T get_days_difference (ts_t start, ts_t stop) noexcept
 Alias for days_between function.
 
template<class T = int>
constexpr T diff_in_days (ts_t start, ts_t stop) noexcept
 Alias for days_between function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T year (ts_t ts=time_shield::ts())
 Alias for year_of function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T to_year (ts_t ts=time_shield::ts())
 Alias for year_of function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T get_year (ts_t ts=time_shield::ts())
 Alias for year_of function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T year_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for year_of_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T to_year_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for year_of_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T get_year_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for year_of_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t year_start (ts_t ts=time_shield::ts())
 Alias for start_of_year function.
 
TIME_SHIELD_CONSTEXPR ts_t year_begin (ts_t ts=time_shield::ts())
 Alias for start_of_year function.
 
ts_ms_t year_start_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for start_of_year_ms function.
 
ts_ms_t year_begin_ms (ts_ms_t ts_ms=time_shield::ts_ms())
 Alias for start_of_year_ms function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR ts_t year_start_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR ts_t year_begin_date (T year)
 Alias for start_of_year_date function.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR 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 ts_ms_t year_begin_date_ms (T year)
 Alias for start_of_year_date_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t year_end (ts_t ts=time_shield::ts())
 Alias for end_of_year function.
 
TIME_SHIELD_CONSTEXPR 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 T1 days_in_month (T2 year, T3 month) noexcept
 Alias for num_days_in_month function.
 
template<class T1 = int>
constexpr 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 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 T1 days_in_year (T2 year) noexcept
 Alias for num_days_in_year function.
 
template<class T = int>
constexpr T days_in_year_ts (ts_t ts=time_shield::ts())
 Alias for num_days_in_year_ts function.
 
constexpr ts_t day_start (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_day function.
 
template<class T = int>
constexpr ts_t previous_day_start (ts_t ts=time_shield::ts(), T days=1) noexcept
 Alias for start_of_prev_day function.
 
constexpr ts_t day_start_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_day_sec function.
 
constexpr ts_t start_day_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_day_sec function.
 
constexpr 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 ts_t next_day_start (ts_t ts, T days=1) noexcept
 Alias for start_of_next_day function.
 
template<class T = int>
constexpr 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 ts_t day_end (ts_t ts=time_shield::ts()) noexcept
 Alias for end_of_day function.
 
constexpr ts_t day_end_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_day_sec function.
 
constexpr 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 T1 day_of_week (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 day_of_week (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 get_weekday (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 get_weekday (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 weekday (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 weekday (year_t year, Month month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr T1 dow (year_t year, int month, int day)
 Alias for day_of_week_date.
 
template<class T1 = Weekday>
constexpr 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>
TIME_SHIELD_CONSTEXPR T1 get_weekday_from_date (const T2 &date)
 Alias for weekday_of_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 weekday_of_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 weekday_of_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 weekday_of_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 weekday_of_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 weekday_of_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 weekday_of_date.
 
template<class T1 = Weekday, class T2, typename std::enable_if< std::is_class< T2 >::value, int >::type = 0>
constexpr T1 wd (const T2 &date)
 Alias for weekday_of_date.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr T day_of_week (U ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr T dow_ts (U ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr T get_dow_from_ts (U ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr T get_weekday_from_ts (U ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday, class U, typename std::enable_if< std::is_integral< U >::value, int >::type = 0>
constexpr T wd_ts (U ts) noexcept
 Alias for weekday_of_ts.
 
template<class T = Weekday>
constexpr T day_of_week_ms (ts_ms_t ts_ms)
 Alias for weekday_of_ts_ms function.
 
template<class T = Weekday>
constexpr T wd_ms (ts_ms_t ts_ms)
 Alias for weekday_of_ts_ms function.
 
TIME_SHIELD_CONSTEXPR ts_t month_begin (ts_t ts=time_shield::ts())
 Alias for start_of_month function.
 
TIME_SHIELD_CONSTEXPR ts_t last_day_of_month (ts_t ts=time_shield::ts())
 Alias for end_of_month function.
 
TIME_SHIELD_CONSTEXPR 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 T1 final_sunday_month_day (T2 year, T3 month)
 Alias for last_sunday_month_day function.
 
constexpr ts_t hour_begin (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_hour function.
 
constexpr ts_t hour_begin_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_hour_sec function.
 
constexpr ts_ms_t hour_begin_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for start_of_hour_ms function.
 
constexpr ts_t finish_of_hour (ts_t ts=time_shield::ts()) noexcept
 Alias for end_of_hour function.
 
constexpr ts_t finish_of_hour_sec (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Alias for end_of_hour_sec function.
 
constexpr 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 T hour_in_day (ts_t ts=time_shield::ts()) noexcept
 Alias for hour_of_day function.
 
constexpr ts_t week_begin (ts_t ts=time_shield::ts())
 Alias for start_of_week function.
 
constexpr ts_t finish_of_week (ts_t ts=time_shield::ts())
 Alias for end_of_week function.
 
constexpr ts_t saturday_begin (ts_t ts=time_shield::ts())
 Alias for start_of_saturday function.
 
constexpr ts_t min_begin (ts_t ts=time_shield::ts()) noexcept
 Alias for start_of_min function.
 
constexpr ts_t finish_of_min (ts_t ts=time_shield::ts()) noexcept
 Alias for end_of_min function.
 
TIME_SHIELD_CONSTEXPR bool workday (ts_t ts) noexcept
 Alias for is_workday(ts_t).
 
TIME_SHIELD_CONSTEXPR bool workday_ms (ts_ms_t ts_ms) noexcept
 Alias for is_workday(ts_ms_t).
 
TIME_SHIELD_CONSTEXPR bool workday (year_t year, int month, int day) noexcept
 Alias for is_workday(year_t, int, int).
 
template<class T>
TIME_SHIELD_CONSTEXPR tz_t tz_offset (const T &tz) noexcept
 Alias for to_tz_offset.
 
TIME_SHIELD_CONSTEXPR tz_t offset_hm (int hour, int min=0) noexcept
 Alias for tz_offset_hm.
 
TIME_SHIELD_CONSTEXPR bool valid_tz_offset (tz_t off) noexcept
 Alias for is_valid_tz_offset.
 
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.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T ns_of_sec (fts_t ts) noexcept
 Get the nanosecond part of the second from a floating-point timestamp.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T us_of_sec (fts_t ts) noexcept
 Get the microsecond part of the second from a floating-point timestamp.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T ms_of_sec (fts_t ts) noexcept
 Get the millisecond part of the second from a floating-point timestamp.
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T ns_of_sec_signed (fts_t ts) noexcept
 Get the nanosecond part of the second from a floating-point timestamp (truncating).
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T us_of_sec_signed (fts_t ts) noexcept
 Get the microsecond part of the second from a floating-point timestamp (truncating).
 
template<class T = int>
TIME_SHIELD_CONSTEXPR T ms_of_sec_signed (fts_t ts) noexcept
 Get the millisecond part of the second from a floating-point timestamp (truncating).
 
template<class T = int>
constexpr T ms_part (ts_ms_t ts) noexcept
 Get the millisecond part of the timestamp.
 
template<class T = int>
constexpr T ms_of_ts (ts_ms_t ts) noexcept
 Alias for ms_part.
 
template<class T = int>
constexpr T us_part (ts_us_t ts) noexcept
 Get the microsecond part of the timestamp.
 
template<class T = int>
constexpr T us_of_ts (ts_us_t ts) noexcept
 Alias for us_part.
 
template<class T = int, class T2 = int64_t>
constexpr T ns_part (T2 ts) noexcept
 Get the nanosecond part of the timestamp.
 
template<class T>
constexpr ts_ms_t sec_to_ms_impl (T t, std::true_type) 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) 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 T1 ms_to_sec (T2 ts_ms) noexcept
 Converts a timestamp from milliseconds to seconds.
 
template<class T = ts_ms_t>
constexpr 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) 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) 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) 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) 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) 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) 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) 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) 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 = int>
TIME_SHIELD_CONSTEXPR T hour24_to_12 (T hour) noexcept
 Converts a 24-hour format hour to a 12-hour format.
 
ts_t cet_to_gmt (ts_t cet)
 Convert Central European Time to Greenwich Mean Time.
 
ts_t eet_to_gmt (ts_t eet)
 Convert Eastern European Time to Greenwich Mean Time.
 
bool is_us_eastern_dst_local (const DateTimeStruct &dt)
 Check if local US Eastern time uses DST.
 
ts_t et_to_gmt (ts_t et)
 Convert US Eastern Time (New York, EST/EDT) to GMT (UTC).
 
ts_t gmt_to_et (ts_t gmt)
 Convert GMT (UTC) to US Eastern Time (New York, EST/EDT).
 
ts_t ny_to_gmt (ts_t ny)
 Convert New York Time to GMT (UTC).
 
ts_t gmt_to_ny (ts_t gmt)
 Convert GMT (UTC) to New York Time.
 
ts_t ct_to_gmt (ts_t ct)
 Convert US Central Time (America/Chicago, CST/CDT) to GMT (UTC).
 
ts_t gmt_to_ct (ts_t gmt)
 Convert GMT (UTC) to US Central Time (America/Chicago, CST/CDT).
 
ts_t gmt_to_cet (ts_t gmt)
 Convert Greenwich Mean Time to Central European Time.
 
ts_t gmt_to_eet (ts_t gmt)
 Convert Greenwich Mean Time to Eastern European Time.
 
TIME_SHIELD_CONSTEXPR ts_t to_utc (ts_t local, tz_t utc_offset) noexcept
 Convert local timestamp (seconds) to UTC using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_t to_local (ts_t utc, tz_t utc_offset) noexcept
 Convert UTC timestamp (seconds) to local time using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_ms_t to_utc_ms (ts_ms_t local_ms, tz_t utc_offset) noexcept
 Convert local timestamp (milliseconds) to UTC using UTC offset.
 
TIME_SHIELD_CONSTEXPR ts_ms_t to_local_ms (ts_ms_t utc_ms, tz_t utc_offset) noexcept
 Convert UTC timestamp (milliseconds) to local time using UTC offset.
 
TIME_SHIELD_CONSTEXPR tz_t utc_offset_of (const TimeZoneStruct &tz) noexcept
 Extract numeric UTC offset (in seconds) from TimeZoneStruct.
 
template<class T = TimeZoneStruct>
to_time_zone (tz_t offset)
 Converts an integer to a time zone structure.
 
template<class T>
TIME_SHIELD_CONSTEXPR tz_t to_tz_offset (const T &tz) noexcept
 Convert time zone struct to offset in seconds.
 
TIME_SHIELD_CONSTEXPR tz_t tz_offset_hm (int hour, int min=0) noexcept
 Build offset in seconds from hours/minutes.
 
TIME_SHIELD_CONSTEXPR bool is_valid_tz_offset (tz_t off) noexcept
 Check if a numeric offset is within supported bounds.
 
template<class T = year_t>
TIME_SHIELD_CONSTEXPR T years_since_epoch (ts_t ts) noexcept
 Converts a UNIX timestamp to a year.
 
template<class Year, class Month, class Day>
TIME_SHIELD_CONSTEXPR dse_t date_to_unix_day (Year year, Month month, Day day) noexcept
 Convert a calendar date to UNIX day count.
 
template<class T = dse_t>
constexpr T days_since_epoch (ts_t ts=time_shield::ts()) noexcept
 Get UNIX day.
 
template<class T = dse_t>
constexpr T days_since_epoch_ms (ts_ms_t t_ms=time_shield::ts_ms()) noexcept
 Get UNIX day from milliseconds timestamp.
 
template<class T = int>
constexpr T days_between (ts_t start, ts_t stop) noexcept
 Get the number of days between two timestamps.
 
template<class T = ts_t>
constexpr T unix_day_to_ts (dse_t unix_day) noexcept
 Converts a UNIX day to a timestamp in seconds.
 
template<class T = ts_t>
constexpr T unix_day_to_ts_ms (dse_t unix_day) noexcept
 Converts a UNIX day to a timestamp in milliseconds.
 
template<class T = ts_t>
constexpr T end_of_day_from_unix_day (dse_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 T end_of_day_from_unix_day_ms (dse_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 T start_of_next_day_from_unix_day (dse_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 T start_of_next_day_from_unix_day_ms (dse_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 T min_since_epoch (ts_t ts=time_shield::ts())
 Get UNIX minute.
 
template<class T = int>
constexpr T sec_of_day (ts_t ts=time_shield::ts()) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr 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 T1 sec_of_day (T2 hour, T2 min, T2 sec) noexcept
 Get the second of the day.
 
template<class T = int>
constexpr T sec_of_min (ts_t ts=time_shield::ts())
 Get the second of the minute.
 
template<class T = int>
constexpr T sec_of_hour (ts_t ts=time_shield::ts())
 Get the second of the hour.
 
TIME_SHIELD_CONSTEXPR int first_workday_day (year_t year, int month) noexcept
 Finds the first workday number within a month.
 
TIME_SHIELD_CONSTEXPR int last_workday_day (year_t year, int month) noexcept
 Finds the last workday number within a month.
 
TIME_SHIELD_CONSTEXPR int count_workdays_in_month (year_t year, int month) noexcept
 Counts workdays within a month.
 
TIME_SHIELD_CONSTEXPR int workday_index_in_month (year_t year, int month, int day) noexcept
 Returns workday position in month starting from 1.
 
TIME_SHIELD_CONSTEXPR bool is_first_workday_of_month (year_t year, int month, int day) noexcept
 Checks whether date is the first workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_first_workdays_of_month (year_t year, int month, int day, int count) noexcept
 Checks if date falls within the first N workdays of the month.
 
TIME_SHIELD_CONSTEXPR bool is_last_workday_of_month (year_t year, int month, int day) noexcept
 Checks whether date is the last workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_last_workdays_of_month (year_t year, int month, int day, int count) noexcept
 Checks if date falls within the last N workdays of the month.
 
TIME_SHIELD_CONSTEXPR bool is_first_workday_of_month (ts_t ts) noexcept
 Checks whether timestamp is the first workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_first_workday_of_month_ms (ts_ms_t ts_ms) noexcept
 Checks whether millisecond timestamp is the first workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_first_workdays_of_month (ts_t ts, int count) noexcept
 Checks if timestamp falls within the first N workdays of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_first_workdays_of_month_ms (ts_ms_t ts_ms, int count) noexcept
 Checks if millisecond timestamp falls within the first N workdays of the month.
 
TIME_SHIELD_CONSTEXPR bool is_last_workday_of_month (ts_t ts) noexcept
 Checks whether timestamp is the last workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_last_workday_of_month_ms (ts_ms_t ts_ms) noexcept
 Checks whether millisecond timestamp is the last workday of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_last_workdays_of_month (ts_t ts, int count) noexcept
 Checks if timestamp falls within the last N workdays of the month.
 
TIME_SHIELD_CONSTEXPR bool is_within_last_workdays_of_month_ms (ts_ms_t ts_ms, int count) noexcept
 Checks if millisecond timestamp falls within the last N workdays of the month.
 
TIME_SHIELD_CONSTEXPR ts_t start_of_first_workday_month (year_t year, int month) noexcept
 Returns start-of-day timestamp for the first workday of month.
 
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_first_workday_month_ms (year_t year, int month) noexcept
 Returns start-of-day millisecond timestamp for the first workday of month.
 
TIME_SHIELD_CONSTEXPR ts_t start_of_first_workday_month (ts_t ts=time_shield::ts()) noexcept
 Returns start-of-day timestamp for the first workday of month derived from timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_first_workday_month_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Returns start-of-day millisecond timestamp for the first workday of month derived from millisecond timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t end_of_first_workday_month (year_t year, int month) noexcept
 Returns end-of-day timestamp for the first workday of month.
 
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_first_workday_month_ms (year_t year, int month) noexcept
 Returns end-of-day millisecond timestamp for the first workday of month.
 
TIME_SHIELD_CONSTEXPR ts_t end_of_first_workday_month (ts_t ts=time_shield::ts()) noexcept
 Returns end-of-day timestamp for the first workday of month derived from timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_first_workday_month_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Returns end-of-day millisecond timestamp for the first workday of month derived from millisecond timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t start_of_last_workday_month (year_t year, int month) noexcept
 Returns start-of-day timestamp for the last workday of month.
 
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_last_workday_month_ms (year_t year, int month) noexcept
 Returns start-of-day millisecond timestamp for the last workday of month.
 
TIME_SHIELD_CONSTEXPR ts_t start_of_last_workday_month (ts_t ts=time_shield::ts()) noexcept
 Returns start-of-day timestamp for the last workday of month derived from timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t start_of_last_workday_month_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Returns start-of-day millisecond timestamp for the last workday of month derived from millisecond timestamp.
 
TIME_SHIELD_CONSTEXPR ts_t end_of_last_workday_month (year_t year, int month) noexcept
 Returns end-of-day timestamp for the last workday of month.
 
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_last_workday_month_ms (year_t year, int month) noexcept
 Returns end-of-day millisecond timestamp for the last workday of month.
 
TIME_SHIELD_CONSTEXPR ts_t end_of_last_workday_month (ts_t ts=time_shield::ts()) noexcept
 Returns end-of-day timestamp for the last workday of month derived from timestamp.
 
TIME_SHIELD_CONSTEXPR ts_ms_t end_of_last_workday_month_ms (ts_ms_t ts_ms=time_shield::ts_ms()) noexcept
 Returns end-of-day millisecond timestamp for the last workday of month derived from millisecond timestamp.
 
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 MS_1 = 1
 1 millisecond
 
constexpr int64_t MS_5 = 5
 5 milliseconds
 
constexpr int64_t MS_10 = 10
 10 milliseconds
 
constexpr int64_t MS_50 = 50
 50 milliseconds
 
constexpr int64_t MS_100 = 100
 100 milliseconds
 
constexpr int64_t MS_250 = 250
 250 milliseconds
 
constexpr int64_t MS_500 = 500
 500 milliseconds
 
constexpr int64_t MS_750 = 750
 750 milliseconds
 
constexpr int64_t SEC_1 = 1
 1 second
 
constexpr int64_t SEC_2 = 2
 2 seconds
 
constexpr int64_t SEC_3 = 3
 3 seconds
 
constexpr int64_t SEC_5 = 5
 5 seconds
 
constexpr int64_t SEC_10 = 10
 10 seconds
 
constexpr int64_t SEC_15 = 15
 15 seconds
 
constexpr int64_t SEC_30 = 30
 30 seconds
 
constexpr int64_t MIN_1 = 1
 1 minute
 
constexpr int64_t MIN_2 = 2
 2 minutes
 
constexpr int64_t MIN_5 = 5
 5 minutes
 
constexpr int64_t MIN_10 = 10
 10 minutes
 
constexpr int64_t MIN_15 = 15
 15 minutes
 
constexpr int64_t MIN_30 = 30
 30 minutes
 
constexpr int64_t HOUR_1 = 1
 1 hour
 
constexpr int64_t HOUR_2 = 2
 2 hours
 
constexpr int64_t HOUR_3 = 3
 3 hours
 
constexpr int64_t HOUR_4 = 4
 4 hours
 
constexpr int64_t HOUR_5 = 5
 5 hours
 
constexpr int64_t HOUR_8 = 8
 8 hours
 
constexpr int64_t HOUR_12 = 12
 12 hours
 
constexpr int64_t HOUR_24 = 24
 24 hours
 
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 = (((std::numeric_limits<int64_t>::max)() - (MS_PER_SEC - 1)) / MS_PER_SEC) - (SEC_PER_YEAR - 1)
 Maximum timestamp value.
 
constexpr int64_t MIN_TIMESTAMP = -MAX_TIMESTAMP
 Minimum timestamp value.
 
constexpr int64_t MAX_TIMESTAMP_MS = MAX_TIMESTAMP * MS_PER_SEC + (MS_PER_SEC - 1)
 Maximum timestamp value in milliseconds.
 
constexpr int64_t MIN_TIMESTAMP_MS = MIN_TIMESTAMP * MS_PER_SEC
 Minimum timestamp value in milliseconds.
 
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.
 
template<class RunnerT>
NtpTimeServiceT< RunnerT > NtpTimeServiceT< RunnerT >::m_instance {}
 
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.

Contains all public types, constants, and functions of the library. The API provides:

  • time and date structures
  • parsing and formatting
  • conversions between representations (seconds/milliseconds, calendar fields, etc.)
  • timezone utilities (named zones, UTC offsets)
  • validation helpers
  • timers and scheduling utilities

Typedef Documentation

◆ MoonPhaseCalculator

Convenience alias for the geocentric Moon phase calculator.

Definition at line 399 of file MoonPhase.hpp.

◆ NtpClientPool

using time_shield::NtpClientPool = NtpClientPoolT<NtpClient>

Definition at line 717 of file ntp_client_pool.hpp.

◆ NtpClientPoolRunner

using time_shield::NtpClientPoolRunner = BasicPoolRunner<NtpClientPool>

Definition at line 217 of file ntp_client_pool_runner.hpp.

◆ timer_state_ptr

Definition at line 111 of file TimerScheduler.hpp.

Function Documentation

◆ date_to_unix_day()

template<class Year, class Month, class Day>
TIME_SHIELD_CONSTEXPR dse_t time_shield::date_to_unix_day ( Year year,
Month month,
Day day )
inlinenoexcept

Convert a calendar date to UNIX day count.

Calculates the number of days since the UNIX epoch (January 1, 1970) for the provided calendar date components.

Note
Inspired by the algorithm described in: https://www.benjoffe.com/fast-date-64 This implementation is written from scratch (no code copied).
Template Parameters
YearType of the year component.
MonthType of the month component.
DayType of the day component.
Parameters
yearYear component of the date.
monthMonth component of the date.
dayDay component of the date.
Returns
Number of days since the UNIX epoch.

Definition at line 122 of file unix_time_conversions.hpp.

◆ days_between()

template<class T = int>
T time_shield::days_between ( ts_t start,
ts_t stop )
constexprnoexcept

Get the number of days between two timestamps.

This function calculates the number of days between two timestamps.

Template Parameters
TThe type of the return value, defaults to int.
Parameters
startThe timestamp of the start of the period.
stopThe timestamp of the end of the period.
Returns
The number of days between start and stop.

Definition at line 166 of file unix_time_conversions.hpp.

◆ days_since_epoch()

template<class T = dse_t>
T time_shield::days_since_epoch ( ts_t ts = time_shield::ts())
constexprnoexcept

Get UNIX day.

This function returns the number of days elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of days since the UNIX epoch.

Definition at line 141 of file unix_time_conversions.hpp.

◆ days_since_epoch_ms()

template<class T = dse_t>
T time_shield::days_since_epoch_ms ( ts_ms_t t_ms = time_shield::ts_ms())
constexprnoexcept

Get UNIX day from milliseconds timestamp.

This function returns the number of days elapsed since the UNIX epoch, given a timestamp in milliseconds.

Template Parameters
TThe return type of the function (default is unixday_t).
Parameters
t_msTimestamp in milliseconds (default is current timestamp in milliseconds).
Returns
Number of days since the UNIX epoch.

Definition at line 153 of file unix_time_conversions.hpp.

◆ end_of_day_from_unix_day()

template<class T = ts_t>
T time_shield::end_of_day_from_unix_day ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the end of the day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the end of the specified day (23:59:59).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the end of the specified UNIX day.

Definition at line 205 of file unix_time_conversions.hpp.

◆ end_of_day_from_unix_day_ms()

template<class T = ts_ms_t>
T time_shield::end_of_day_from_unix_day_ms ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the end of the day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the end of the specified day (23:59:59.999).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the end of the specified UNIX day.

Definition at line 218 of file unix_time_conversions.hpp.

◆ fts_to_jd()

jd_t time_shield::fts_to_jd ( fts_t ts)
inlinenoexcept

Convert Unix timestamp (floating seconds) to Julian Date (JD).

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Julian Date value.

Definition at line 28 of file astronomy_conversions.hpp.

◆ fts_to_mjd()

mjd_t time_shield::fts_to_mjd ( fts_t ts)
inlinenoexcept

Convert Unix timestamp (floating seconds) to Modified Julian Date (MJD).

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Modified Julian Date value.

Definition at line 91 of file astronomy_conversions.hpp.

◆ fts_to_oadate()

TIME_SHIELD_CONSTEXPR oadate_t time_shield::fts_to_oadate ( fts_t ts)
inlinenoexcept

Convert Unix timestamp (floating seconds) to OA date.

Parameters
tsUnix timestamp in seconds as floating point (may be negative).
Returns
OA date value.

Definition at line 38 of file ole_automation_conversions.hpp.

◆ gregorian_to_jd() [1/2]

jd_t time_shield::gregorian_to_jd ( double day,
int64_t month,
int64_t year )
inlinenoexcept

Convert Gregorian date (with optional fractional day) to Julian Date (JD).

Parameters
dayDay of month (may include fractional part).
monthMonth [1..12].
yearFull year (e.g. 2025).
Returns
Julian Date value.

Definition at line 47 of file astronomy_conversions.hpp.

◆ gregorian_to_jd() [2/2]

jd_t time_shield::gregorian_to_jd ( uint32_t day,
uint32_t month,
uint32_t year,
uint32_t hour,
uint32_t minute,
uint32_t second = 0,
uint32_t millisecond = 0 )
inlinenoexcept

Convert Gregorian date/time components to Julian Date (JD).

Parameters
dayDay of month [1..31].
monthMonth [1..12].
yearFull year (e.g. 2025).
hourHour of day [0..23].
minuteMinute of hour [0..59].
secondSecond of minute [0..59].
millisecondMillisecond of second [0..999].
Returns
Julian Date value.

Definition at line 70 of file astronomy_conversions.hpp.

◆ gregorian_to_jdn()

jdn_t time_shield::gregorian_to_jdn ( uint32_t day,
uint32_t month,
uint32_t year )
inlinenoexcept

Convert Gregorian date to Julian Day Number (JDN).

JDN is an integer day count (no fractional part).

Parameters
dayDay of month [1..31].
monthMonth [1..12].
yearFull year (e.g. 2025).
Returns
Julian Day Number value.

Definition at line 108 of file astronomy_conversions.hpp.

◆ is_first_quarter_window()

bool time_shield::is_first_quarter_window ( fts_t ts,
double window_seconds = astronomy::MoonPhase::kDefaultQuarterWindow_s )
inlinenoexcept

Check if timestamp falls into the first quarter window (default \pm12h).

Definition at line 209 of file astronomy_conversions.hpp.

◆ is_full_moon_window()

bool time_shield::is_full_moon_window ( fts_t ts,
double window_seconds = astronomy::MoonPhase::kDefaultQuarterWindow_s )
inlinenoexcept

Check if timestamp falls into the full moon window (default \pm12h).

Definition at line 203 of file astronomy_conversions.hpp.

◆ is_last_quarter_window()

bool time_shield::is_last_quarter_window ( fts_t ts,
double window_seconds = astronomy::MoonPhase::kDefaultQuarterWindow_s )
inlinenoexcept

Check if timestamp falls into the last quarter window (default \pm12h).

Definition at line 215 of file astronomy_conversions.hpp.

◆ is_new_moon_window()

bool time_shield::is_new_moon_window ( fts_t ts,
double window_seconds = astronomy::MoonPhase::kDefaultQuarterWindow_s )
inlinenoexcept

Check if timestamp falls into the new moon window (default \pm12h).

Definition at line 197 of file astronomy_conversions.hpp.

◆ min_since_epoch()

template<class T = int64_t>
T time_shield::min_since_epoch ( ts_t ts = time_shield::ts())
constexpr

Get UNIX minute.

This function returns the number of minutes elapsed since the UNIX epoch.

Template Parameters
TThe return type of the function (default is int64_t).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Number of minutes since the UNIX epoch.

Definition at line 256 of file unix_time_conversions.hpp.

◆ moon_age_days()

double time_shield::moon_age_days ( fts_t ts)
inlinenoexcept

Get lunar age in days (~0..29.53).

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Approximate lunar age in days.

Definition at line 183 of file astronomy_conversions.hpp.

◆ moon_age_days_jd_approx()

double time_shield::moon_age_days_jd_approx ( fts_t ts)
inlinenoexcept

Get lunar age in days (~0..29.53) using a simple Julian Day approximation.

This helper mirrors the legacy Julian Day based approximation and is less precise than the geocentric MoonPhase calculator.

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Approximate lunar age in days.

Definition at line 176 of file astronomy_conversions.hpp.

◆ moon_illumination()

double time_shield::moon_illumination ( fts_t ts)
inlinenoexcept

Get illuminated fraction in range [0..1] using the geocentric MoonPhase calculator.

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Illuminated fraction of the Moon.

Definition at line 166 of file astronomy_conversions.hpp.

◆ moon_phase()

double time_shield::moon_phase ( fts_t ts)
inlinenoexcept

Get lunar phase in range [0..1) using the geocentric MoonPhase calculator.

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Lunar phase fraction where 0 is new moon.

Definition at line 149 of file astronomy_conversions.hpp.

◆ moon_phase_jd_approx()

double time_shield::moon_phase_jd_approx ( fts_t ts)
inlinenoexcept

Get lunar phase in range [0..1) using a simple Julian Day approximation.

This helper mirrors the legacy Julian Day based approximation and is less precise than the geocentric MoonPhase calculator.

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Approximate lunar phase fraction where 0 is new moon.

Definition at line 139 of file astronomy_conversions.hpp.

◆ moon_phase_sincos()

MoonPhaseSineCosine time_shield::moon_phase_sincos ( fts_t ts)
inlinenoexcept

Get sin/cos of the lunar phase angle (continuous signal without wrap-around).

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Structure containing sin/cos and the angle in radians.

Definition at line 157 of file astronomy_conversions.hpp.

◆ moon_quarters()

astronomy::MoonQuarterInstants time_shield::moon_quarters ( fts_t ts)
inlinenoexcept

Quarter instants around the provided timestamp.

Parameters
tsUnix timestamp in floating seconds since Unix epoch.
Returns
Quarter windows around the timestamp (Unix seconds as double).

Definition at line 191 of file astronomy_conversions.hpp.

◆ oadate_to_fts()

TIME_SHIELD_CONSTEXPR fts_t time_shield::oadate_to_fts ( oadate_t oa)
inlinenoexcept

Convert OA date to Unix timestamp (floating seconds).

Parameters
oaOA date value.
Returns
Unix timestamp in seconds as floating point.

Definition at line 63 of file ole_automation_conversions.hpp.

◆ oadate_to_ts()

TIME_SHIELD_CONSTEXPR ts_t time_shield::oadate_to_ts ( oadate_t oa)
inlinenoexcept

Convert OA date to Unix timestamp (seconds).

Parameters
oaOA date value.
Returns
Unix timestamp in seconds (truncated toward zero).

Definition at line 54 of file ole_automation_conversions.hpp.

◆ oadate_to_ts_ms()

TIME_SHIELD_CONSTEXPR ts_ms_t time_shield::oadate_to_ts_ms ( oadate_t oa)
inlinenoexcept

Convert OA date to Unix timestamp (milliseconds).

Parameters
oaOA date value.
Returns
Unix timestamp in milliseconds (truncated toward zero).

Definition at line 71 of file ole_automation_conversions.hpp.

◆ sec_of_day() [1/2]

template<class T1 = int, class T2 = int>
T1 time_shield::sec_of_day ( T2 hour,
T2 min,
T2 sec )
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.

Template Parameters
T1The return type of the function (default is int).
T2The type of the hour, minute, and second parameters (default is int).
Parameters
hourHour of the day.
minMinute of the hour.
secSecond of the minute.
Returns
Second of the day.

Definition at line 295 of file unix_time_conversions.hpp.

◆ sec_of_day() [2/2]

template<class T = int>
T time_shield::sec_of_day ( ts_t ts = time_shield::ts())
constexprnoexcept

Get the second of the day.

This function returns a value from 0 to MAX_SEC_PER_DAY representing the second of the day.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the day.

Definition at line 268 of file unix_time_conversions.hpp.

◆ sec_of_day_ms()

template<class T = int>
T time_shield::sec_of_day_ms ( ts_ms_t ts_ms)
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.

Template Parameters
TThe return type of the function (default is int).
Parameters
ts_msTimestamp in milliseconds.
Returns
Second of the day.

Definition at line 280 of file unix_time_conversions.hpp.

◆ sec_of_hour()

template<class T = int>
T time_shield::sec_of_hour ( ts_t ts = time_shield::ts())
constexpr

Get the second of the hour.

This function returns a value between 0 and 3599 representing the second of the hour.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the hour.

Definition at line 324 of file unix_time_conversions.hpp.

◆ sec_of_min()

template<class T = int>
T time_shield::sec_of_min ( ts_t ts = time_shield::ts())
constexpr

Get the second of the minute.

This function returns a value between 0 and 59 representing the second of the minute.

Template Parameters
TThe return type of the function (default is int).
Parameters
tsTimestamp in seconds (default is current timestamp).
Returns
Second of the minute.

Definition at line 312 of file unix_time_conversions.hpp.

◆ start_of_next_day_from_unix_day()

template<class T = ts_ms_t>
T time_shield::start_of_next_day_from_unix_day ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the start of the next day in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the next day (00:00:00).

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the next UNIX day.

Definition at line 231 of file unix_time_conversions.hpp.

◆ start_of_next_day_from_unix_day_ms()

template<class T = ts_ms_t>
T time_shield::start_of_next_day_from_unix_day_ms ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp representing the start of the next day in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the next day (00:00:00.000).

Template Parameters
TThe return type of the function (default is ts_ms_t).
Parameters
unix_dayThe number of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the next UNIX day.

Definition at line 244 of file unix_time_conversions.hpp.

◆ to_oadate()

template<class T1, class T2, class T3>
TIME_SHIELD_CONSTEXPR oadate_t time_shield::to_oadate ( T1 year,
T2 month,
T2 day,
T2 hour = 0,
T2 min = 0,
T2 sec = 0,
T3 ms = 0 )
inlinenoexcept

Build OA date from calendar components (Gregorian).

Template Parameters
T1Year type.
T2Month/day/time components type.
T3Milliseconds type.
Returns
OA date value.

Definition at line 83 of file ole_automation_conversions.hpp.

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

◆ ts_ms_to_oadate()

TIME_SHIELD_CONSTEXPR oadate_t time_shield::ts_ms_to_oadate ( ts_ms_t ts_ms)
inlinenoexcept

Convert Unix timestamp (milliseconds) to OA date.

Parameters
ts_msUnix timestamp in milliseconds (may be negative).
Returns
OA date value.

Definition at line 46 of file ole_automation_conversions.hpp.

◆ ts_to_jd()

jd_t time_shield::ts_to_jd ( ts_t ts)
inlinenoexcept

Convert Unix timestamp (seconds) to Julian Date (JD).

Parameters
tsUnix timestamp in seconds since Unix epoch.
Returns
Julian Date value.

Definition at line 38 of file astronomy_conversions.hpp.

◆ ts_to_mjd()

mjd_t time_shield::ts_to_mjd ( ts_t ts)
inlinenoexcept

Convert Unix timestamp (seconds) to Modified Julian Date (MJD).

Parameters
tsUnix timestamp in seconds since Unix epoch.
Returns
Modified Julian Date value.

Definition at line 98 of file astronomy_conversions.hpp.

◆ ts_to_oadate()

TIME_SHIELD_CONSTEXPR oadate_t time_shield::ts_to_oadate ( ts_t ts)
inlinenoexcept

Convert Unix timestamp (seconds) to OA date.

Parameters
tsUnix timestamp in seconds (may be negative).
Returns
OA date value.

Definition at line 30 of file ole_automation_conversions.hpp.

◆ unix_day_to_ts()

template<class T = ts_t>
T time_shield::unix_day_to_ts ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp in seconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in seconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in seconds representing the beginning of the specified UNIX day.

Definition at line 179 of file unix_time_conversions.hpp.

◆ unix_day_to_ts_ms()

template<class T = ts_t>
T time_shield::unix_day_to_ts_ms ( dse_t unix_day)
constexprnoexcept

Converts a UNIX day to a timestamp in milliseconds.

Converts a number of days since the UNIX epoch (January 1, 1970) to the corresponding timestamp in milliseconds at the start of the specified day.

Template Parameters
TThe return type of the function (default is ts_t).
Parameters
unix_dayNumber of days since the UNIX epoch.
Returns
The timestamp in milliseconds representing the beginning of the specified UNIX day.

Definition at line 192 of file unix_time_conversions.hpp.

◆ years_since_epoch()

template<class T = year_t>
TIME_SHIELD_CONSTEXPR T time_shield::years_since_epoch ( ts_t ts)
noexcept

Converts a UNIX timestamp to a year.

Template Parameters
TThe type of the year (default is year_t).
Parameters
tsUNIX timestamp.
Returns
T Year corresponding to the given timestamp.
Note
Inspired by the algorithm described in: https://www.benjoffe.com/fast-date-64 This implementation is written from scratch (no code copied).

Definition at line 68 of file unix_time_conversions.hpp.

Variable Documentation

◆ NtpTimeServiceT< RunnerT >::m_instance

template<class RunnerT>
NtpTimeServiceT<RunnerT> time_shield::NtpTimeServiceT< RunnerT >::m_instance {}
inline

Definition at line 542 of file ntp_time_service.hpp.