Time Shield Library
C++ library for working with time
Loading...
Searching...
No Matches
constants.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
3#define _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
4
9
10#include <cstdint>
11#include <limits>
12
13namespace time_shield {
14
31
32 // Nanoseconds and microseconds
33 constexpr int64_t NS_PER_US = 1000;
34 constexpr int64_t NS_PER_MS = 1000000;
35 constexpr int64_t NS_PER_SEC = 1000000000;
36
37 // Microseconds and milliseconds
38 constexpr int64_t US_PER_SEC = 1000000;
39 constexpr int64_t MS_PER_SEC = 1000;
40 constexpr int64_t MS_PER_1_SEC = 1000;
41 constexpr int64_t MS_PER_5_SEC = 5000;
42 constexpr int64_t MS_PER_10_SEC = 10000;
43 constexpr int64_t MS_PER_15_SEC = 15000;
44 constexpr int64_t MS_PER_30_SEC = 30000;
45 constexpr int64_t MS_PER_MIN = 60000;
46 constexpr int64_t MS_PER_1_MIN = 60000;
47 constexpr int64_t MS_PER_5_MIN = 300000;
48 constexpr int64_t MS_PER_10_MIN = 600000;
49 constexpr int64_t MS_PER_15_MIN = 900000;
50 constexpr int64_t MS_PER_30_MIN = 1800000;
51 constexpr int64_t MS_PER_HALF_HOUR = 1800000;
52 constexpr int64_t MS_PER_HOUR = 3600000;
53 constexpr int64_t MS_PER_1_HOUR = 3600000;
54 constexpr int64_t MS_PER_2_HOUR = 7200000;
55 constexpr int64_t MS_PER_4_HOUR = 14400000;
56 constexpr int64_t MS_PER_5_HOUR = 18000000;
57 constexpr int64_t MS_PER_8_HOUR = 28800000;
58 constexpr int64_t MS_PER_12_HOUR = 43200000;
59 constexpr int64_t MS_PER_DAY = 86400000;
60
61 // Seconds
62 constexpr int64_t SEC_PER_MIN = 60;
63 constexpr int64_t SEC_PER_1_MIN = 60;
64 constexpr int64_t SEC_PER_3_MIN = 180;
65 constexpr int64_t SEC_PER_5_MIN = 300;
66 constexpr int64_t SEC_PER_10_MIN = 600;
67 constexpr int64_t SEC_PER_15_MIN = 900;
68 constexpr int64_t SEC_PER_HALF_HOUR = 1800;
69 constexpr int64_t SEC_PER_HOUR = 3600;
70 constexpr int64_t SEC_PER_1_HOUR = 3600;
71 constexpr int64_t SEC_PER_2_HOUR = 7200;
72 constexpr int64_t SEC_PER_4_HOUR = 14400;
73 constexpr int64_t SEC_PER_5_HOUR = 18000;
74 constexpr int64_t SEC_PER_8_HOUR = 28800;
75 constexpr int64_t SEC_PER_12_HOUR = 43200;
76 constexpr int64_t SEC_PER_DAY = 86400;
77 constexpr int64_t SEC_PER_YEAR = 31536000;
78 constexpr int64_t AVG_SEC_PER_YEAR = 31557600;
79 constexpr int64_t SEC_PER_LEAP_YEAR = 31622400;
80 constexpr int64_t SEC_PER_4_YEARS = 126230400;
81 constexpr int64_t SEC_PER_FIRST_100_YEARS = 3155760000;
82 constexpr int64_t SEC_PER_100_YEARS = 3155673600;
83 constexpr int64_t SEC_PER_400_YEARS = 12622780800;
84 constexpr int64_t MAX_SEC_PER_DAY = 86399;
85
86 // Minutes
87 constexpr int64_t MIN_PER_HOUR = 60;
88 constexpr int64_t MIN_PER_DAY = 1440;
89 constexpr int64_t MIN_PER_1_DAY = 1440;
90 constexpr int64_t MIN_PER_2_DAY = 2*1440;
91 constexpr int64_t MIN_PER_5_DAY = 5*1440;
92 constexpr int64_t MIN_PER_7_DAY = 7*1440;
93 constexpr int64_t MIN_PER_WEEK = 10080;
94 constexpr int64_t MIN_PER_10_DAY = 10*1440;
95 constexpr int64_t MIN_PER_15_DAY = 15*1440;
96 constexpr int64_t MIN_PER_30_DAY = 15*1440;
97 constexpr int64_t MIN_PER_MONTH = 40320;
98 constexpr int64_t MAX_MOON_MIN = 42523;
99
100 // Hours and days
101 constexpr int64_t HOURS_PER_DAY = 24;
102 constexpr int64_t DAYS_PER_WEEK = 7;
103 constexpr int64_t DAYS_PER_LEAP_YEAR = 366;
104 constexpr int64_t DAYS_PER_YEAR = 365;
105 constexpr int64_t DAYS_PER_4_YEARS = 1461;
106
107 // Months and years
108 const int64_t MONTHS_PER_YEAR = 12;
109 const int64_t MAX_DAYS_PER_MONTH = 31;
110 const int64_t LEAP_YEAR_PER_100_YEAR = 24;
111 const int64_t LEAP_YEAR_PER_400_YEAR = 97;
112
113 // Epoch and maximum values
114 constexpr int64_t UNIX_EPOCH = 1970;
115 constexpr int64_t OLE_EPOCH = 25569;
116 constexpr int64_t MAX_YEAR = 292277022000LL;
117 constexpr int64_t MIN_YEAR = -2967369602200LL;
118 constexpr int64_t ERROR_YEAR = 9223372036854770000LL;
119 constexpr int64_t MAX_TIMESTAMP = 9223371890843040000LL;
120 constexpr int64_t ERROR_TIMESTAMP = 9223372036854770000LL;
121 constexpr double MAX_OADATE = (std::numeric_limits<double>::max)();
122 constexpr double AVG_DAYS_PER_YEAR = 365.25;
123
125
126}; // namespace time_shield
127
128#endif // _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
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.