Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
constants.mqh
Go to the documentation of this file.
1//+------------------------------------------------------------------+
2//| constants.mqh |
3//| Time Shield - MQL5 Constants |
4//| Copyright 2025, NewYaroslav |
5//| https://github.com/NewYaroslav/time-shield-cpp |
6//+------------------------------------------------------------------+
7#ifndef __TIME_SHIELD_CONSTANTS_MQH__
8#define __TIME_SHIELD_CONSTANTS_MQH__
9
15
16#property copyright "Copyright 2025, NewYaroslav"
17#property link "https://github.com/NewYaroslav/time-shield-cpp"
18#property strict
19
20namespace time_shield {
21
38
39 // Nanoseconds and microseconds
40 const long NS_PER_US = 1000;
41 const long NS_PER_MS = 1000000;
42 const long NS_PER_SEC = 1000000000;
43
44 // Microseconds and milliseconds
45 const long US_PER_SEC = 1000000;
46 const long MS_PER_SEC = 1000;
47 const long MS_PER_1_SEC = 1000;
48 const long MS_PER_5_SEC = 5000;
49 const long MS_PER_10_SEC = 10000;
50 const long MS_PER_15_SEC = 15000;
51 const long MS_PER_30_SEC = 30000;
52 const long MS_PER_MIN = 60000;
53 const long MS_PER_1_MIN = 60000;
54 const long MS_PER_5_MIN = 300000;
55 const long MS_PER_10_MIN = 600000;
56 const long MS_PER_15_MIN = 900000;
57 const long MS_PER_30_MIN = 1800000;
58 const long MS_PER_HALF_HOUR = 1800000;
59 const long MS_PER_HOUR = 3600000;
60 const long MS_PER_1_HOUR = 3600000;
61 const long MS_PER_2_HOUR = 7200000;
62 const long MS_PER_4_HOUR = 14400000;
63 const long MS_PER_5_HOUR = 18000000;
64 const long MS_PER_8_HOUR = 28800000;
65 const long MS_PER_12_HOUR = 43200000;
66 const long MS_PER_DAY = 86400000;
67
68 // Seconds
69 const long SEC_PER_MIN = 60;
70 const long SEC_PER_1_MIN = 60;
71 const long SEC_PER_3_MIN = 180;
72 const long SEC_PER_5_MIN = 300;
73 const long SEC_PER_10_MIN = 600;
74 const long SEC_PER_15_MIN = 900;
75 const long SEC_PER_HALF_HOUR = 1800;
76 const long SEC_PER_HOUR = 3600;
77 const long SEC_PER_1_HOUR = 3600;
78 const long SEC_PER_2_HOUR = 7200;
79 const long SEC_PER_4_HOUR = 14400;
80 const long SEC_PER_5_HOUR = 18000;
81 const long SEC_PER_8_HOUR = 28800;
82 const long SEC_PER_12_HOUR = 43200;
83 const long SEC_PER_DAY = 86400;
84 const long SEC_PER_YEAR = 31536000;
85 const long AVG_SEC_PER_YEAR = 31557600;
86 const long SEC_PER_LEAP_YEAR = 31622400;
87 const long SEC_PER_4_YEARS = 126230400;
88 const long SEC_PER_FIRST_100_YEARS = 3155760000;
89 const long SEC_PER_100_YEARS = 3155673600;
90 const long SEC_PER_400_YEARS = 12622780800;
91 const long MAX_SEC_PER_DAY = 86399;
92
93 // Minutes
94 const long MIN_PER_HOUR = 60;
95 const long MIN_PER_DAY = 1440;
96 const long MIN_PER_1_DAY = 1440;
97 const long MIN_PER_2_DAY = 2*1440;
98 const long MIN_PER_5_DAY = 5*1440;
99 const long MIN_PER_7_DAY = 7*1440;
100 const long MIN_PER_WEEK = 10080;
101 const long MIN_PER_10_DAY = 10*1440;
102 const long MIN_PER_15_DAY = 15*1440;
103 const long MIN_PER_30_DAY = 15*1440;
104 const long MIN_PER_MONTH = 40320;
105 const long MAX_MOON_MIN = 42523;
106
107 // Hours and days
108 const long HOURS_PER_DAY = 24;
109 const long DAYS_PER_WEEK = 7;
110 const long DAYS_PER_LEAP_YEAR = 366;
111 const long DAYS_PER_YEAR = 365;
112 const long DAYS_PER_4_YEARS = 1461;
113
114 // Months and years
115 const long MONTHS_PER_YEAR = 12;
116 const long MAX_DAYS_PER_MONTH = 31;
117 const long LEAP_YEAR_PER_100_YEAR = 24;
118 const long LEAP_YEAR_PER_400_YEAR = 97;
119
120 // Epoch and maximum values
121 const long UNIX_EPOCH = 1970;
122 const long OLE_EPOCH = 25569;
123 const long MAX_YEAR = 292277022000;
124 const long MIN_YEAR = -2967369602200;
125 const long ERROR_YEAR = 9223372036854770000;
126 const long MAX_TIMESTAMP = 9223371890843040000;
127 const long ERROR_TIMESTAMP = 9223372036854770000;
128 const double MAX_OADATE = 1.7976931348623158e+308;
129 const double AVG_DAYS_PER_YEAR = 365.25;
130
132
133}; // namespace time_shield
134
135#endif // __TIME_SHIELD_CONSTANTS_MQH__
constexpr int64_t ERROR_YEAR
Error year value.
constexpr int64_t MIN_PER_15_DAY
Minutes per 15 day.
Definition constants.hpp:95
const int64_t MAX_DAYS_PER_MONTH
Maximum days per month.
constexpr int64_t MIN_PER_30_DAY
Minutes per 30 day.
Definition constants.hpp:96
constexpr int64_t SEC_PER_12_HOUR
Seconds per 12 hour.
Definition constants.hpp:75
constexpr int64_t SEC_PER_4_HOUR
Seconds per 4 hour.
Definition constants.hpp:72
const int64_t LEAP_YEAR_PER_100_YEAR
Leap years per 100 years.
constexpr int64_t SEC_PER_10_MIN
Seconds per 10 minute.
Definition constants.hpp:66
constexpr int64_t MIN_PER_HOUR
Minutes per hour.
Definition constants.hpp:87
constexpr int64_t SEC_PER_8_HOUR
Seconds per 8 hour.
Definition constants.hpp:74
constexpr int64_t DAYS_PER_4_YEARS
Days per 4 years.
constexpr int64_t ERROR_TIMESTAMP
Error timestamp value.
constexpr double MAX_OADATE
Maximum OLE automation date.
constexpr int64_t SEC_PER_5_MIN
Seconds per 5 minute.
Definition constants.hpp:65
constexpr int64_t DAYS_PER_WEEK
Days per week.
constexpr double AVG_DAYS_PER_YEAR
Average days per year.
constexpr int64_t MS_PER_30_SEC
Milliseconds per 30 second.
Definition constants.hpp:44
constexpr int64_t SEC_PER_YEAR
Seconds per year (365 days)
Definition constants.hpp:77
const int64_t LEAP_YEAR_PER_400_YEAR
Leap years per 400 years.
constexpr int64_t SEC_PER_FIRST_100_YEARS
Seconds per first 100 years.
Definition constants.hpp:81
constexpr int64_t MIN_PER_WEEK
Minutes per week.
Definition constants.hpp:93
constexpr int64_t SEC_PER_1_HOUR
Seconds per 1 hour.
Definition constants.hpp:70
const int64_t MONTHS_PER_YEAR
Months per year.
constexpr int64_t DAYS_PER_YEAR
Days per year.
constexpr int64_t MS_PER_8_HOUR
Milliseconds per 8 hour.
Definition constants.hpp:57
constexpr int64_t HOURS_PER_DAY
Hours per day.
constexpr int64_t MS_PER_HALF_HOUR
Milliseconds per half hour.
Definition constants.hpp:51
constexpr int64_t MS_PER_5_HOUR
Milliseconds per 5 hour.
Definition constants.hpp:56
constexpr int64_t OLE_EPOCH
OLE automation date since UNIX epoch.
constexpr int64_t MS_PER_30_MIN
Milliseconds per 30 minute.
Definition constants.hpp:50
constexpr int64_t MS_PER_2_HOUR
Milliseconds per 2 hour.
Definition constants.hpp:54
constexpr int64_t SEC_PER_100_YEARS
Seconds per 100 years.
Definition constants.hpp:82
constexpr int64_t MIN_PER_2_DAY
Minutes per 2 day.
Definition constants.hpp:90
constexpr int64_t MIN_PER_10_DAY
Minutes per 10 day.
Definition constants.hpp:94
constexpr int64_t MS_PER_5_MIN
Milliseconds per 5 minute.
Definition constants.hpp:47
constexpr int64_t SEC_PER_2_HOUR
Seconds per 2 hour.
Definition constants.hpp:71
constexpr int64_t MAX_YEAR
Maximum representable year.
constexpr int64_t MS_PER_MIN
Milliseconds per minute.
Definition constants.hpp:45
constexpr int64_t SEC_PER_15_MIN
Seconds per 15 minute.
Definition constants.hpp:67
constexpr int64_t MS_PER_15_SEC
Milliseconds per 15 second.
Definition constants.hpp:43
constexpr int64_t SEC_PER_LEAP_YEAR
Seconds per leap year (366 days)
Definition constants.hpp:79
constexpr int64_t AVG_SEC_PER_YEAR
Average seconds per year (365.25 days)
Definition constants.hpp:78
constexpr int64_t MIN_PER_DAY
Minutes per day.
Definition constants.hpp:88
constexpr int64_t DAYS_PER_LEAP_YEAR
Days per leap year.
constexpr int64_t MS_PER_10_MIN
Milliseconds per 10 minute.
Definition constants.hpp:48
constexpr int64_t SEC_PER_HOUR
Seconds per hour.
Definition constants.hpp:69
constexpr int64_t UNIX_EPOCH
Start year of UNIX time.
constexpr int64_t NS_PER_US
Nanoseconds per microsecond.
Definition constants.hpp:33
constexpr int64_t SEC_PER_3_MIN
Seconds per 3 minute.
Definition constants.hpp:64
constexpr int64_t NS_PER_MS
Nanoseconds per millisecond.
Definition constants.hpp:34
constexpr int64_t MS_PER_DAY
Milliseconds per day.
Definition constants.hpp:59
constexpr int64_t MIN_PER_1_DAY
Minutes per 1 day.
Definition constants.hpp:89
constexpr int64_t MIN_PER_MONTH
Minutes per month (28 days)
Definition constants.hpp:97
constexpr int64_t MS_PER_1_SEC
Milliseconds per 1 second.
Definition constants.hpp:40
constexpr int64_t MAX_SEC_PER_DAY
Maximum seconds per day.
Definition constants.hpp:84
constexpr int64_t MS_PER_SEC
Milliseconds per second.
Definition constants.hpp:39
constexpr int64_t SEC_PER_400_YEARS
Seconds per 400 years.
Definition constants.hpp:83
constexpr int64_t SEC_PER_DAY
Seconds per day.
Definition constants.hpp:76
constexpr int64_t SEC_PER_1_MIN
Seconds per 1 minute.
Definition constants.hpp:63
constexpr int64_t MS_PER_10_SEC
Milliseconds per 10 seconds.
Definition constants.hpp:42
constexpr int64_t SEC_PER_MIN
Seconds per minute.
Definition constants.hpp:62
constexpr int64_t NS_PER_SEC
Nanoseconds per second.
Definition constants.hpp:35
constexpr int64_t MS_PER_4_HOUR
Milliseconds per 4 hour.
Definition constants.hpp:55
constexpr int64_t MS_PER_HOUR
Milliseconds per hour.
Definition constants.hpp:52
constexpr int64_t SEC_PER_5_HOUR
Seconds per 5 hour.
Definition constants.hpp:73
constexpr int64_t MS_PER_12_HOUR
Milliseconds per 12 hour.
Definition constants.hpp:58
constexpr int64_t MIN_PER_5_DAY
Minutes per 5 day.
Definition constants.hpp:91
constexpr int64_t MS_PER_5_SEC
Milliseconds per 5 second.
Definition constants.hpp:41
constexpr int64_t US_PER_SEC
Microseconds per second.
Definition constants.hpp:38
constexpr int64_t MAX_MOON_MIN
Maximum lunar minutes.
Definition constants.hpp:98
constexpr int64_t MS_PER_1_HOUR
Milliseconds per 1 hour.
Definition constants.hpp:53
constexpr int64_t SEC_PER_4_YEARS
Seconds per 4 years.
Definition constants.hpp:80
constexpr int64_t MS_PER_1_MIN
Milliseconds per 1 minute.
Definition constants.hpp:46
constexpr int64_t MIN_YEAR
Minimum representable year.
constexpr int64_t MAX_TIMESTAMP
Maximum timestamp value.
constexpr int64_t SEC_PER_HALF_HOUR
Seconds per half hour.
Definition constants.hpp:68
constexpr int64_t MIN_PER_7_DAY
Minutes per 7 day.
Definition constants.hpp:92
constexpr int64_t MS_PER_15_MIN
Milliseconds per 15 minute.
Definition constants.hpp:49
Main namespace for the Time Shield library.