acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
_.h
1#pragma once
2
3
4struct system_time_t;
5
6
7class file_time;
8
9
10class system_time;
11
12//
13//inline int32_t is_leap_year(int32_t year)
14//{
15//
16// return year % 400 == 0 ? 1 : (year % 100 == 0 ? 0 : (year % 4 == 0 ? 1 : 0));
17//
18//}
19//
20//
21//inline int32_t days_from_0(int32_t year)
22//{
23//
24// year--;
25//
26// return 365 * year + (year / 400) - (year/100) + (year / 4);
27//
28//}
29//
30//
31//inline int32_t days_from_1970(int32_t year)
32//{
33//
34// static const ::i32 days_from_0_to_1970 = days_from_0(1970);
35//
36// return days_from_0(year) - days_from_0_to_1970;
37//
38//}
39//
40//
41//inline int32_t days_from_1jan(int32_t year,int32_t month,int32_t day)
42//{
43//
44// static const int32_t days[2][12] =
45// {
46//
47// { 0,31,59,90,120,151,181,212,243,273,304,334},
48// { 0,31,60,91,121,152,182,213,244,274,305,335}
49//
50// };
51//
52// return days[is_leap_year(year)][month-1] + day - 1;
53//
54//}
55//
57//inline posix_time make_utc_time(struct tm const *t)
58//{
59//
60// ::i32 year = t->tm_year + 1900;
61//
62// ::i32 month = t->tm_mon;
63//
64// if(month > 11)
65// {
66//
67// year += month/12;
68//
69// month %= 12;
70//
71// }
72// else if(month < 0)
73// {
74//
75// ::i32 years_diff = (-month + 11)/12;
76//
77// year -= years_diff;
78//
79// month+=12 * years_diff;
80//
81// }
82//
83// month++;
84//
85// ::i32 day = t->tm_mday;
86//
87// ::i32 day_of_year = days_from_1jan(year,month,day);
88//
89// ::i32 days_since_epoch = days_from_1970(year) + day_of_year;
90//
91// posix_time seconds_in_day = 3600 * 24;
92//
93// posix_time result = seconds_in_day * days_since_epoch + 3600 * t->tm_hour + 60 * t->tm_min + t->tm_sec;
94//
95// return result;
96//
97//}
98
99
100//class second;
101//class time;
102//class microsecond;
103//class nanosecond;
104class time;
105
106
107namespace earth
108{
109
110 class time;
111 class time_span;
112 class zone_time;
113 class date_span;
114
115} // namespace earth
116
117
118namespace datetime
119{
120
121
122 class time_zone;
123
124
125} // namespace datetime;
126
127
128
129namespace earth
130{
131
132
133 class gregorian_time;
134
135
136} // namespace earth
137
138
139
140//#ifdef WINDOWS
141//
142//
143//extern "C" CLASS_DECL_ACME posix_time timegm(struct tm *tmp);
144//
145//
146//#endif
147
148
149extern "C" CLASS_DECL_ACME ::i32 c_localtime_offset();
150
151
152
153//#include "micro_time.h"
154//
155//
156//#include "time_span.h"
157//
158//
159//#include "date_span.h"
160//
161//
162//#include "earth_time.h"
163//
164//
165//#include "system_time.h"
166//
167//
168//#include "result.h"
169//
170//
171//#include "microsecond_sleep.h"
172//
173//
174//#ifdef WINDOWS
175//
176//
177//extern "C" CLASS_DECL_ACME posix_time timegm(struct tm *tmp);
178//
179//
180//#endif
181//
182//
183//extern "C" CLASS_DECL_ACME ::i32 c_localtime_offset();
184//
185//
186//#include "micro_time.h"
187//
188//
189//
Definition time_zone.h:10
Definition date_span.h:9
Definition earth_gregorian_time.h:15
Definition earth_time_span.h:20
Definition earth_time.h:33
Definition earth_zone_time.h:13
Definition file_time.h:11
Definition system_time.h:8
Definition aaa_time.h:13