1 /*
2  * hunt-time: A time library for D programming language.
3  *
4  * Copyright (C) 2015-2018 HuntLabs
5  *
6  * Website: https://www.huntlabs.net/
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module hunt.time.Constants;
13 
14 /**
15 */
16 struct TimeConstant {
17     
18     /**
19      * Hours per day.
20      */
21     enum int HOURS_PER_DAY = 24;
22     /**
23      * Minutes per hour.
24      */
25     enum int MINUTES_PER_HOUR = 60;
26     /**
27      * Minutes per day.
28      */
29     enum int MINUTES_PER_DAY = MINUTES_PER_HOUR * HOURS_PER_DAY;
30     /**
31      * Seconds per minute.
32      */
33     enum int SECONDS_PER_MINUTE = 60;
34     /**
35      * Seconds per hour.
36      */
37     enum int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
38     /**
39      * Seconds per day.
40      */
41     enum int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
42     /**
43      * Milliseconds per day.
44      */
45     enum long MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L;
46     /**
47      * Microseconds per day.
48      */
49     enum long MICROS_PER_DAY = SECONDS_PER_DAY * 1000_000L;
50     /**
51      * Nanos per millisecond.
52      */
53     enum long NANOS_PER_MILLI = 1000_000L;
54     /**
55      * Nanos per second.
56      */
57     enum long NANOS_PER_SECOND =  1000_000_000L;
58     /**
59      * Nanos per minute.
60      */
61     enum long NANOS_PER_MINUTE = NANOS_PER_SECOND * SECONDS_PER_MINUTE;
62     /**
63      * Nanos per hour.
64      */
65     enum long NANOS_PER_HOUR = NANOS_PER_MINUTE * MINUTES_PER_HOUR;
66     /**
67      * Nanos per day.
68      */
69     enum long NANOS_PER_DAY = NANOS_PER_HOUR * HOURS_PER_DAY;
70 }
71 
72 
73 /**
74 */
75 struct MonthCode {
76     /**
77      * The month of January with 31 days.
78      * This has the numeric value of {@code 1}.
79      */
80     enum JANUARY = 1;
81     /**
82      * The month of February with 28 days, or 29 _in a leap year.
83      * This has the numeric value of {@code 2}.
84      */
85     enum FEBRUARY = 2;
86     /**
87      * The month of March with 31 days.
88      * This has the numeric value of {@code 3}.
89      */
90     enum MARCH = 3;
91     /**
92      * The month of April with 30 days.
93      * This has the numeric value of {@code 4}.
94      */
95     enum APRIL = 4;
96     /**
97      * The month of May with 31 days.
98      * This has the numeric value of {@code 5}.
99      */
100     enum MAY = 5;
101     /**
102      * The month of June with 30 days.
103      * This has the numeric value of {@code 6}.
104      */
105     enum JUNE = 6;
106     /**
107      * The month of July with 31 days.
108      * This has the numeric value of {@code 7}.
109      */
110     enum JULY = 7;
111     /**
112      * The month of August with 31 days.
113      * This has the numeric value of {@code 8}.
114      */
115     enum AUGUST = 8;
116     /**
117      * The month of September with 30 days.
118      * This has the numeric value of {@code 9}.
119      */
120     enum SEPTEMBER = 9;
121     /**
122      * The month of October with 31 days.
123      * This has the numeric value of {@code 10}.
124      */
125     enum OCTOBER = 10;
126     /**
127      * The month of November with 30 days.
128      * This has the numeric value of {@code 11}.
129      */
130     enum NOVEMBER = 11;
131     /**
132      * The month of December with 31 days.
133      * This has the numeric value of {@code 12}.
134      */
135     enum DECEMBER = 12;
136 }
137 
138 /**
139 */
140 struct MonthName {
141     /**
142      * The month of January with 31 days.
143      * This has the numeric value of {@code 1}.
144      */
145     enum JANUARY = "JANUARY";
146     /**
147      * The month of February with 28 days, or 29 _in a leap year.
148      * This has the numeric value of {@code 2}.
149      */
150     enum FEBRUARY = "FEBRUARY";
151     /**
152      * The month of March with 31 days.
153      * This has the numeric value of {@code 3}.
154      */
155     enum MARCH = "MARCH";
156     /**
157      * The month of April with 30 days.
158      * This has the numeric value of {@code 4}.
159      */
160     enum APRIL = "APRIL";
161     /**
162      * The month of May with 31 days.
163      * This has the numeric value of {@code 5}.
164      */
165     enum MAY = "MAY";
166     /**
167      * The month of June with 30 days.
168      * This has the numeric value of {@code 6}.
169      */
170     enum JUNE = "JUNE";
171     /**
172      * The month of July with 31 days.
173      * This has the numeric value of {@code 7}.
174      */
175     enum JULY = "JULY";
176     /**
177      * The month of August with 31 days.
178      * This has the numeric value of {@code 8}.
179      */
180     enum AUGUST = "AUGUST";
181     /**
182      * The month of September with 30 days.
183      * This has the numeric value of {@code 9}.
184      */
185     enum SEPTEMBER = "SEPTEMBER";
186     /**
187      * The month of October with 31 days.
188      * This has the numeric value of {@code 10}.
189      */
190     enum OCTOBER = "OCTOBER";
191     /**
192      * The month of November with 30 days.
193      * This has the numeric value of {@code 11}.
194      */
195     enum NOVEMBER = "NOVEMBER";
196     /**
197      * The month of December with 31 days.
198      * This has the numeric value of {@code 12}.
199      */
200     enum DECEMBER = "DECEMBER";
201 }