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
6#ifndef _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
7#define _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
8
9#include <cstdint>
10#include <limits>
11
12namespace time_shield {
13
30
31 // Nanoseconds and microseconds
32 constexpr int64_t NS_PER_US = 1000;
33 constexpr int64_t NS_PER_MS = 1000000;
34 constexpr int64_t NS_PER_SEC = 1000000000;
35
36 // Microseconds and milliseconds
37 constexpr int64_t US_PER_SEC = 1000000;
38 constexpr int64_t MS_PER_SEC = 1000;
39 constexpr int64_t MS_PER_5_SEC = 5000;
40 constexpr int64_t MS_PER_10_SEC = 5000;
41 constexpr int64_t MS_PER_15_SEC = 15000;
42 constexpr int64_t MS_PER_30_SEC = 30000;
43 constexpr int64_t MS_PER_MIN = 60000;
44 constexpr int64_t MS_PER_5_MIN = 300000;
45 constexpr int64_t MS_PER_10_MIN = 600000;
46 constexpr int64_t MS_PER_15_MIN = 900000;
47 constexpr int64_t MS_PER_30_MIN = 1800000;
48 constexpr int64_t MS_PER_HALF_HOUR = 1800000;
49 constexpr int64_t MS_PER_HOUR = 3600000;
50 constexpr int64_t MS_PER_DAY = 86400000;
51
52 // Seconds
53 constexpr int64_t SEC_PER_MIN = 60;
54 constexpr int64_t SEC_PER_3_MIN = 180;
55 constexpr int64_t SEC_PER_5_MIN = 300;
56 constexpr int64_t SEC_PER_10_MIN = 600;
57 constexpr int64_t SEC_PER_15_MIN = 900;
58 constexpr int64_t SEC_PER_HALF_HOUR = 1800;
59 constexpr int64_t SEC_PER_HOUR = 3600;
60 constexpr int64_t SEC_PER_DAY = 86400;
61 constexpr int64_t SEC_PER_YEAR = 31536000;
62 constexpr int64_t AVG_SEC_PER_YEAR = 31557600;
63 constexpr int64_t SEC_PER_LEAP_YEAR = 31622400;
64 constexpr int64_t SEC_PER_4_YEARS = 126230400;
65 constexpr int64_t SEC_PER_FIRST_100_YEARS = 3155760000;
66 constexpr int64_t SEC_PER_100_YEARS = 3155673600;
67 constexpr int64_t SEC_PER_400_YEARS = 12622780800;
68 constexpr int64_t MAX_SEC_PER_DAY = 86399;
69
70 // Minutes
71 constexpr int64_t MIN_PER_HOUR = 60;
72 constexpr int64_t MIN_PER_DAY = 1440;
73 constexpr int64_t MIN_PER_2_DAY = 2*1440;
74 constexpr int64_t MIN_PER_5_DAY = 5*1440;
75 constexpr int64_t MIN_PER_7_DAY = 7*1440;
76 constexpr int64_t MIN_PER_WEEK = 10080;
77 constexpr int64_t MIN_PER_10_DAY = 10*1440;
78 constexpr int64_t MIN_PER_15_DAY = 15*1440;
79 constexpr int64_t MIN_PER_30_DAY = 15*1440;
80 constexpr int64_t MIN_PER_MONTH = 40320;
81 constexpr int64_t MAX_MOON_MIN = 42523;
82
83 // Hours and days
84 constexpr int64_t HOURS_PER_DAY = 24;
85 constexpr int64_t DAYS_PER_WEEK = 7;
86 constexpr int64_t DAYS_PER_LEAP_YEAR = 366;
87 constexpr int64_t DAYS_PER_YEAR = 365;
88 constexpr int64_t DAYS_PER_4_YEARS = 1461;
89
90 // Months and years
91 const int64_t MONTHS_PER_YEAR = 12;
92 const int64_t MAX_DAYS_PER_MONTH = 31;
93 const int64_t LEAP_YEAR_PER_100_YEAR = 24;
94 const int64_t LEAP_YEAR_PER_400_YEAR = 97;
95
96 // Epoch and maximum values
97 constexpr int64_t UNIX_EPOCH = 1970;
98 constexpr int64_t OLE_EPOCH = 25569;
99 constexpr int64_t MAX_YEAR = 292277022000LL;
100 constexpr int64_t MIN_YEAR = -2967369602200LL;
101 constexpr int64_t ERROR_YEAR = 9223372036854770000LL;
102 constexpr int64_t MAX_TIMESTAMP = 9223371890843040000LL;
103 constexpr int64_t ERROR_TIMESTAMP = 9223372036854770000LL;
104 constexpr double MAX_OADATE = std::numeric_limits<double>::max();
105 constexpr double AVG_DAYS_PER_YEAR = 365.25;
106
108
109}; // namespace time_shield
110
111#endif // _TIME_SHIELD_CONSTANTS_HPP_INCLUDED
const int64_t MONTHS_PER_YEAR
Months per year.
Definition constants.hpp:91
constexpr int64_t SEC_PER_LEAP_YEAR
Seconds per leap year (366 days)
Definition constants.hpp:63
constexpr int64_t HOURS_PER_DAY
Hours per day.
Definition constants.hpp:84
constexpr int64_t OLE_EPOCH
OLE automation date since UNIX epoch.
Definition constants.hpp:98
constexpr int64_t SEC_PER_FIRST_100_YEARS
Seconds per first 100 years.
Definition constants.hpp:65
constexpr int64_t SEC_PER_10_MIN
Seconds per 10 minute.
Definition constants.hpp:56
constexpr int64_t SEC_PER_5_MIN
Seconds per 5 minute.
Definition constants.hpp:55
constexpr int64_t MIN_YEAR
Minimum representable year.
constexpr int64_t SEC_PER_3_MIN
Seconds per 3 minute.
Definition constants.hpp:54
constexpr int64_t MIN_PER_WEEK
Minutes per week.
Definition constants.hpp:76
constexpr int64_t MIN_PER_HOUR
Minutes per hour.
Definition constants.hpp:71
constexpr int64_t MIN_PER_2_DAY
Minutes per 2 day.
Definition constants.hpp:73
constexpr int64_t MIN_PER_DAY
Minutes per day.
Definition constants.hpp:72
constexpr int64_t DAYS_PER_LEAP_YEAR
Days per leap year.
Definition constants.hpp:86
constexpr int64_t MS_PER_10_MIN
Milliseconds per 10 minute.
Definition constants.hpp:45
const int64_t LEAP_YEAR_PER_400_YEAR
Leap years per 400 years.
Definition constants.hpp:94
constexpr int64_t NS_PER_US
Nanoseconds per microsecond.
Definition constants.hpp:32
constexpr int64_t MS_PER_DAY
Milliseconds per day.
Definition constants.hpp:50
constexpr int64_t MAX_TIMESTAMP
Maximum timestamp value.
constexpr int64_t MS_PER_HOUR
Milliseconds per hour.
Definition constants.hpp:49
constexpr int64_t DAYS_PER_YEAR
Days per year.
Definition constants.hpp:87
constexpr int64_t MIN_PER_15_DAY
Minutes per 15 day.
Definition constants.hpp:78
constexpr int64_t MAX_SEC_PER_DAY
Maximum seconds per day.
Definition constants.hpp:68
constexpr int64_t MIN_PER_5_DAY
Minutes per 5 day.
Definition constants.hpp:74
constexpr int64_t MIN_PER_MONTH
Minutes per month (28 days)
Definition constants.hpp:80
constexpr int64_t SEC_PER_DAY
Seconds per day.
Definition constants.hpp:60
constexpr int64_t MS_PER_5_MIN
Milliseconds per 5 minute.
Definition constants.hpp:44
constexpr int64_t MS_PER_SEC
Milliseconds per second.
Definition constants.hpp:38
constexpr int64_t SEC_PER_MIN
Seconds per minute.
Definition constants.hpp:53
constexpr int64_t MS_PER_HALF_HOUR
Milliseconds per half hour.
Definition constants.hpp:48
constexpr int64_t SEC_PER_HOUR
Seconds per hour.
Definition constants.hpp:59
constexpr int64_t MS_PER_15_MIN
Milliseconds per 15 minute.
Definition constants.hpp:46
constexpr int64_t DAYS_PER_4_YEARS
Days per 4 years.
Definition constants.hpp:88
constexpr int64_t MS_PER_30_MIN
Milliseconds per 30 minute.
Definition constants.hpp:47
constexpr int64_t ERROR_TIMESTAMP
Error timestamp value.
constexpr int64_t DAYS_PER_WEEK
Days per week.
Definition constants.hpp:85
constexpr int64_t MIN_PER_30_DAY
Minutes per 30 day.
Definition constants.hpp:79
constexpr int64_t NS_PER_MS
Nanoseconds per millisecond.
Definition constants.hpp:33
constexpr int64_t SEC_PER_4_YEARS
Seconds per 4 years.
Definition constants.hpp:64
constexpr int64_t SEC_PER_100_YEARS
Seconds per 100 years.
Definition constants.hpp:66
constexpr int64_t MIN_PER_7_DAY
Minutes per 7 day.
Definition constants.hpp:75
constexpr int64_t MS_PER_15_SEC
Milliseconds per 15 second.
Definition constants.hpp:41
constexpr double MAX_OADATE
Maximum OLE automation date.
constexpr int64_t SEC_PER_15_MIN
Seconds per 15 minute.
Definition constants.hpp:57
constexpr int64_t MS_PER_5_SEC
Milliseconds per 5 second.
Definition constants.hpp:39
constexpr int64_t SEC_PER_400_YEARS
Seconds per 400 years.
Definition constants.hpp:67
constexpr int64_t MAX_YEAR
Maximum representable year.
Definition constants.hpp:99
constexpr int64_t AVG_SEC_PER_YEAR
Average seconds per year (365.25 days)
Definition constants.hpp:62
constexpr int64_t MS_PER_30_SEC
Milliseconds per 30 second.
Definition constants.hpp:42
constexpr int64_t MS_PER_MIN
Milliseconds per minute.
Definition constants.hpp:43
constexpr double AVG_DAYS_PER_YEAR
Average days per year.
constexpr int64_t MS_PER_10_SEC
Milliseconds per 10 second.
Definition constants.hpp:40
constexpr int64_t NS_PER_SEC
Nanoseconds per second.
Definition constants.hpp:34
const int64_t LEAP_YEAR_PER_100_YEAR
Leap years per 100 years.
Definition constants.hpp:93
constexpr int64_t UNIX_EPOCH
Start year of UNIX time.
Definition constants.hpp:97
constexpr int64_t MIN_PER_10_DAY
Minutes per 10 day.
Definition constants.hpp:77
constexpr int64_t SEC_PER_HALF_HOUR
Seconds per half hour.
Definition constants.hpp:58
constexpr int64_t SEC_PER_YEAR
Seconds per year (365 days)
Definition constants.hpp:61
const int64_t MAX_DAYS_PER_MONTH
Maximum days per month.
Definition constants.hpp:92
constexpr int64_t ERROR_YEAR
Error year value.
constexpr int64_t MAX_MOON_MIN
Maximum lunar minutes.
Definition constants.hpp:81
constexpr int64_t US_PER_SEC
Microseconds per second.
Definition constants.hpp:37
Main namespace for the Time Shield library.
Definition constants.hpp:12