]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/date_time/test/posix_time/testdst_rules.cpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / libs / date_time / test / posix_time / testdst_rules.cpp
1 /* Copyright (c) 2002,2003 CrystalClear Software, Inc.
2 * Use, modification and distribution is subject to the
3 * Boost Software License, Version 1.0. (See accompanying
4 * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5 * Author: Jeff Garland
6 */
7
8 #include "boost/date_time/posix_time/posix_time.hpp"
9 #include "boost/date_time/local_timezone_defs.hpp"
10 #include "../testfrmwk.hpp"
11
12 // Define dst rule for Paraguay which is transitions forward on Oct 1 and
13 // back Mar 1
14
15 struct paraguay_dst_traits {
16 typedef boost::gregorian::date date_type;
17 typedef boost::gregorian::date::day_type day_type;
18 typedef boost::gregorian::date::month_type month_type;
19 typedef boost::gregorian::date::year_type year_type;
20 typedef boost::date_time::partial_date<boost::gregorian::date> start_rule_functor;
21 typedef boost::date_time::partial_date<boost::gregorian::date> end_rule_functor;
22 static day_type start_day(year_type) {return 1;}
23 static month_type start_month(year_type) {return boost::date_time::Oct;}
24 static day_type end_day(year_type) {return 1;}
25 static month_type end_month(year_type) {return boost::date_time::Mar;}
26 static int dst_start_offset_minutes() { return 120;}
27 static int dst_end_offset_minutes() { return 120; }
28 static int dst_shift_length_minutes() { return 60; }
29 static date_type local_dst_start_day(year_type year)
30 {
31 start_rule_functor start(start_day(year),
32 start_month(year));
33 return start.get_date(year);
34 }
35 static date_type local_dst_end_day(year_type year)
36 {
37 end_rule_functor end(end_day(year),
38 end_month(year));
39 return end.get_date(year);
40 }
41
42
43 };
44
45
46 // see http://www.timeanddate.com/time/aboutdst.html for some info
47 // also
48 int
49 main()
50 {
51 using namespace boost::posix_time;
52 using namespace boost::gregorian;
53 date d(2002,Feb,1);
54 ptime t(d);
55
56 //The following defines the US dst boundaries, except that the
57 //start and end dates are hard coded.
58 typedef boost::date_time::us_dst_rules<date, time_duration, 120, 60> us_dst_local;
59 date dst_start(2002,Apr, 7);
60 date dst_end(2002,Oct, 27);
61
62 ptime t3a(dst_start, time_duration(2,0,0)); //invalid time label
63 ptime t3b(dst_start, time_duration(2,59,59)); //invalid time label
64 ptime t4(dst_start, time_duration(1,59,59)); //not ds
65 ptime t5(dst_start, time_duration(3,0,0)); //always dst
66 ptime t6(dst_end, time_duration(0,59,59)); //is dst
67 ptime t7(dst_end, time_duration(1,0,0)); //ambiguous
68 ptime t8(dst_end, time_duration(1,59,59)); //ambiguous
69 ptime t9(dst_end, time_duration(2,0,0)); //always not dst
70
71 check("dst start", us_dst_local::local_dst_start_day(2002) == dst_start);
72 check("dst end", us_dst_local::local_dst_end_day(2002) == dst_end);
73 check("dst boundary", us_dst_local::is_dst_boundary_day(dst_start));
74 check("dst boundary", us_dst_local::is_dst_boundary_day(dst_end));
75 check("check if time is dst -- not",
76 us_dst_local::local_is_dst(t.date(), t.time_of_day())==boost::date_time::is_not_in_dst);
77 check("label on dst boundary invalid",
78 us_dst_local::local_is_dst(t3a.date(),t3a.time_of_day())==boost::date_time::invalid_time_label);
79 check("label on dst boundary invalid",
80 us_dst_local::local_is_dst(t3b.date(),t3b.time_of_day())==boost::date_time::invalid_time_label);
81 check("check if time is dst -- not",
82 us_dst_local::local_is_dst(t4.date(),t4.time_of_day())==boost::date_time::is_not_in_dst);
83 check("check if time is dst -- yes",
84 us_dst_local::local_is_dst(t5.date(),t5.time_of_day())==boost::date_time::is_in_dst);
85
86 check("check if time is dst -- not",
87 us_dst_local::local_is_dst(t6.date(),t6.time_of_day())==boost::date_time::is_in_dst);
88 check("check if time is dst -- ambig",
89 us_dst_local::local_is_dst(t7.date(),t7.time_of_day())==boost::date_time::ambiguous);
90 check("check if time is dst -- ambig",
91 us_dst_local::local_is_dst(t8.date(),t8.time_of_day())==boost::date_time::ambiguous);
92 check("check if time is dst -- not",
93 us_dst_local::local_is_dst(t9.date(),t9.time_of_day())==boost::date_time::is_not_in_dst);
94
95
96 //Now try a local without dst
97 typedef boost::date_time::null_dst_rules<date, time_duration> no_dst_adj;
98
99 check("check null dst rules",
100 no_dst_adj::local_is_dst(t4.date(),t4.time_of_day())==boost::date_time::is_not_in_dst);
101 check("check null dst rules",
102 no_dst_adj::local_is_dst(t5.date(),t5.time_of_day())==boost::date_time::is_not_in_dst);
103 check("check null dst rules",
104 no_dst_adj::utc_is_dst(t4.date(),t4.time_of_day())==boost::date_time::is_not_in_dst);
105 check("check null dst rules",
106 no_dst_adj::utc_is_dst(t5.date(),t5.time_of_day())==boost::date_time::is_not_in_dst);
107
108
109 //Try a southern hemisphere adjustment calculation
110 //This is following the rules for South Australia as best I can
111 //decipher them. Basically conversion to DST is last Sunday in
112 //October 02:00:00 and conversion off of dst is last sunday in
113 //March 02:00:00.
114 //This stuff uses the dst calculator directly...
115 date dst_start2(2002,Oct,27); //last Sunday in Oct
116 date dst_end2(2002,Mar,31); //last Sunday in March
117
118 typedef boost::date_time::dst_calculator<date,time_duration> dstcalc;
119 //clearly not in dst
120 boost::date_time::time_is_dst_result a1 =
121 dstcalc::local_is_dst(date(2002,May,1),hours(3),
122 dst_start2, 120,
123 dst_end2, 180,
124 60);
125
126 check("check southern not dst", a1==boost::date_time::is_not_in_dst);
127
128 boost::date_time::time_is_dst_result a2 =
129 dstcalc::local_is_dst(date(2002,Jan,1),hours(3),
130 dst_start2, 120,
131 dst_end2, 180,
132 60);
133
134 check("check southern is dst", a2==boost::date_time::is_in_dst);
135
136 boost::date_time::time_is_dst_result a3 =
137 dstcalc::local_is_dst(date(2002,Oct,28),hours(3),
138 dst_start2, 120,
139 dst_end2, 180,
140 60);
141
142 check("check southern is dst", a3==boost::date_time::is_in_dst);
143 boost::date_time::time_is_dst_result a4 =
144 dstcalc::local_is_dst(date(2002,Oct,27),time_duration(1,59,59),
145 dst_start2, 120,
146 dst_end2, 180,
147 60);
148 check("check southern boundary-not dst", a4==boost::date_time::is_not_in_dst);
149 boost::date_time::time_is_dst_result a5 =
150 dstcalc::local_is_dst(date(2002,Oct,27),hours(3),
151 dst_start2, 120,
152 dst_end2, 180,
153 60);
154 check("check southern boundary-is dst", a5==boost::date_time::is_in_dst);
155 boost::date_time::time_is_dst_result a6 =
156 dstcalc::local_is_dst(date(2002,Oct,27),hours(2),
157 dst_start2, 120,
158 dst_end2, 180,
159 60);
160 check("check southern boundary-invalid time", a6==boost::date_time::invalid_time_label);
161 boost::date_time::time_is_dst_result a7 =
162 dstcalc::local_is_dst(date(2002,Mar,31),time_duration(1,59,59),
163 dst_start2, 120,
164 dst_end2, 180,
165 60);
166 check("check southern boundary-is dst", a7==boost::date_time::is_in_dst);
167 boost::date_time::time_is_dst_result a8 =
168 dstcalc::local_is_dst(date(2002,Mar,31),time_duration(2,0,0),
169 dst_start2, 120,
170 dst_end2, 180,
171 60);
172 check("check southern boundary-ambiguous", a8==boost::date_time::ambiguous);
173 boost::date_time::time_is_dst_result a9 =
174 dstcalc::local_is_dst(date(2002,Mar,31),time_duration(2,59,59),
175 dst_start2, 120,
176 dst_end2, 180,
177 60);
178 check("check southern boundary-ambiguous", a9==boost::date_time::ambiguous);
179 boost::date_time::time_is_dst_result a10 =
180 dstcalc::local_is_dst(date(2002,Mar,31),time_duration(3,0,0),
181 dst_start2, 120,
182 dst_end2, 180,
183 60);
184 check("check southern boundary-not", a10==boost::date_time::is_not_in_dst);
185
186 /******************** post release 1 -- new dst calc engine ********/
187
188 typedef boost::date_time::us_dst_trait<date> us_dst_traits;
189 typedef boost::date_time::dst_calc_engine<date, time_duration, us_dst_traits>
190 us_dst_calc2;
191
192 {
193 // us_dst_calc2
194 check("dst start", us_dst_calc2::local_dst_start_day(2002) == dst_start);
195 check("dst end", us_dst_calc2::local_dst_end_day(2002) == dst_end);
196 // std::cout << us_dst_calc2::local_dst_end_day(2002) << std::endl;
197 check("dst boundary", us_dst_calc2::is_dst_boundary_day(dst_start));
198 check("dst boundary", us_dst_calc2::is_dst_boundary_day(dst_end));
199
200 check("check if time is dst -- not",
201 us_dst_calc2::local_is_dst(t.date(), t.time_of_day())==boost::date_time::is_not_in_dst);
202 check("label on dst boundary invalid",
203 us_dst_calc2::local_is_dst(t3a.date(),t3a.time_of_day())==boost::date_time::invalid_time_label);
204 check("label on dst boundary invalid",
205 us_dst_calc2::local_is_dst(t3b.date(),t3b.time_of_day())==boost::date_time::invalid_time_label);
206 check("check if time is dst -- not",
207 us_dst_calc2::local_is_dst(t4.date(),t4.time_of_day())==boost::date_time::is_not_in_dst);
208 check("check if time is dst -- yes",
209 us_dst_calc2::local_is_dst(t5.date(),t5.time_of_day())==boost::date_time::is_in_dst);
210
211 check("check if time is dst -- not",
212 us_dst_calc2::local_is_dst(t6.date(),t6.time_of_day())==boost::date_time::is_in_dst);
213 check("check if time is dst -- ambig",
214 us_dst_calc2::local_is_dst(t7.date(),t7.time_of_day())==boost::date_time::ambiguous);
215 check("check if time is dst -- ambig",
216 us_dst_calc2::local_is_dst(t8.date(),t8.time_of_day())==boost::date_time::ambiguous);
217 check("check if time is dst -- not",
218 us_dst_calc2::local_is_dst(t9.date(),t9.time_of_day())==boost::date_time::is_not_in_dst);
219 }
220 {
221 //some new checks for the new 2007 us dst rules
222 date dst_start07(2007,Mar, 11);
223 date dst_end07(2007,Nov, 4);
224
225 check("dst start07", us_dst_calc2::local_dst_start_day(2007) == dst_start07);
226 check("dst end07", us_dst_calc2::local_dst_end_day(2007) == dst_end07);
227 check("dst boundary07", us_dst_calc2::is_dst_boundary_day(dst_start07));
228 check("dst boundary07", us_dst_calc2::is_dst_boundary_day(dst_end07));
229
230 date dst_start08(2008,Mar, 9);
231 date dst_end08(2008,Nov, 2);
232
233 check("dst start08", us_dst_calc2::local_dst_start_day(2008) == dst_start08);
234 check("dst end08", us_dst_calc2::local_dst_end_day(2008) == dst_end08);
235 check("dst boundary08", us_dst_calc2::is_dst_boundary_day(dst_start08));
236 check("dst boundary08", us_dst_calc2::is_dst_boundary_day(dst_end08));
237
238 date dst_start09(2009,Mar, 8);
239 date dst_end09(2009,Nov, 1);
240
241 check("dst start09", us_dst_calc2::local_dst_start_day(2009) == dst_start09);
242 check("dst end09", us_dst_calc2::local_dst_end_day(2009) == dst_end09);
243 check("dst boundary09", us_dst_calc2::is_dst_boundary_day(dst_start09));
244 check("dst boundary09", us_dst_calc2::is_dst_boundary_day(dst_end09));
245
246 }
247
248
249
250 /******************** post release 1 -- new dst calc engine - eu dst ********/
251
252
253 typedef boost::date_time::eu_dst_trait<date> eu_dst_traits;
254 typedef boost::date_time::dst_calc_engine<date, time_duration, eu_dst_traits>
255 eu_dst_calc;
256 date eu_dst_start(2002,Mar, 31);
257 date eu_dst_end(2002,Oct, 27);
258 ptime eu_invalid1(eu_dst_start, time_duration(2,0,0)); //invalid time label
259 ptime eu_invalid2(eu_dst_start, time_duration(2,59,59)); //invalid time label
260 ptime eu_notdst1(eu_dst_start, time_duration(1,59,59)); //not ds
261 ptime eu_isdst1(eu_dst_start, time_duration(3,0,0)); //always dst
262 ptime eu_isdst2(eu_dst_end, time_duration(1,59,59)); //is dst
263 ptime eu_amgbig1(eu_dst_end, time_duration(2,0,0)); //ambiguous
264 ptime eu_amgbig2(eu_dst_end, time_duration(2,59,59)); //ambiguous
265 ptime eu_notdst2(eu_dst_end, time_duration(3,0,0)); //always not dst
266
267 check("eu dst start", eu_dst_calc::local_dst_start_day(2002) == eu_dst_start);
268 check("eu dst end", eu_dst_calc::local_dst_end_day(2002) == eu_dst_end);
269 check("eu dst boundary", eu_dst_calc::is_dst_boundary_day(eu_dst_start));
270 check("eu dst boundary", eu_dst_calc::is_dst_boundary_day(eu_dst_end));
271 // on forward shift boundaries
272 check("eu label on dst boundary invalid",
273 eu_dst_calc::local_is_dst(eu_invalid1.date(),eu_invalid1.time_of_day())==boost::date_time::invalid_time_label);
274 check("eu label on dst boundary invalid",
275 eu_dst_calc::local_is_dst(eu_invalid2.date(),eu_invalid2.time_of_day())==boost::date_time::invalid_time_label);
276 check("eu check if time is dst -- not",
277 eu_dst_calc::local_is_dst(eu_notdst1.date(),eu_notdst1.time_of_day())==boost::date_time::is_not_in_dst);
278 check("check if time is dst -- yes",
279 eu_dst_calc::local_is_dst(eu_isdst1.date(),eu_isdst1.time_of_day())==boost::date_time::is_in_dst);
280 //backward shift boundary
281 check("eu check if time is dst -- yes",
282 eu_dst_calc::local_is_dst(eu_isdst2.date(),eu_isdst2.time_of_day())==boost::date_time::is_in_dst);
283 check("eu check if time is dst -- ambig",
284 eu_dst_calc::local_is_dst(eu_amgbig1.date(),eu_amgbig1.time_of_day())==boost::date_time::ambiguous);
285 check("eu check if time is dst -- ambig",
286 eu_dst_calc::local_is_dst(eu_amgbig2.date(),eu_amgbig2.time_of_day())==boost::date_time::ambiguous);
287 check("eu check if time is dst -- not",
288 eu_dst_calc::local_is_dst(eu_notdst2.date(),eu_notdst2.time_of_day())==boost::date_time::is_not_in_dst);
289
290 /******************** post release 1 -- new dst calc engine - gb dst ********/
291
292
293 /* Several places in Great Britan use eu start and end rules for the
294 day, but different local conversion times (eg: forward change at 1:00
295 am local and backward change at 2:00 am dst instead of 2:00am
296 forward and 3:00am back for the EU).
297 */
298
299 typedef boost::date_time::uk_dst_trait<date> uk_dst_traits;
300
301 typedef boost::date_time::dst_calc_engine<date, time_duration, uk_dst_traits> uk_dst_calc;
302
303
304 date uk_dst_start(2002,Mar, 31);
305 date uk_dst_end(2002,Oct, 27);
306 ptime uk_invalid1(uk_dst_start, time_duration(1,0,0)); //invalid time label
307 ptime uk_invalid2(uk_dst_start, time_duration(1,59,59)); //invalid time label
308 ptime uk_notdst1(uk_dst_start, time_duration(0,59,59)); //not ds
309 ptime uk_isdst1(uk_dst_start, time_duration(2,0,0)); //always dst
310 ptime uk_isdst2(uk_dst_end, time_duration(0,59,59)); //is dst
311 ptime uk_amgbig1(uk_dst_end, time_duration(1,0,0)); //ambiguous
312 ptime uk_amgbig2(uk_dst_end, time_duration(1,59,59)); //ambiguous
313 ptime uk_notdst2(uk_dst_end, time_duration(3,0,0)); //always not dst
314
315 check("uk dst start", uk_dst_calc::local_dst_start_day(2002) == uk_dst_start);
316 check("uk dst end", uk_dst_calc::local_dst_end_day(2002) == uk_dst_end);
317 check("uk dst boundary", uk_dst_calc::is_dst_boundary_day(uk_dst_start));
318 check("uk dst boundary", uk_dst_calc::is_dst_boundary_day(uk_dst_end));
319 // on forward shift boundaries
320 check("uk label on dst boundary invalid",
321 uk_dst_calc::local_is_dst(uk_invalid1.date(),uk_invalid1.time_of_day())==boost::date_time::invalid_time_label);
322 check("uk label on dst boundary invalid",
323 uk_dst_calc::local_is_dst(uk_invalid2.date(),uk_invalid2.time_of_day())==boost::date_time::invalid_time_label);
324 check("uk check if time is dst -- not",
325 uk_dst_calc::local_is_dst(uk_notdst1.date(),uk_notdst1.time_of_day())==boost::date_time::is_not_in_dst);
326 check("uk check if time is dst -- yes",
327 uk_dst_calc::local_is_dst(uk_isdst1.date(),uk_isdst1.time_of_day())==boost::date_time::is_in_dst);
328 //backward shift boundary
329 check("uk check if time is dst -- yes",
330 uk_dst_calc::local_is_dst(uk_isdst2.date(),uk_isdst2.time_of_day())==boost::date_time::is_in_dst);
331 check("uk check if time is dst -- ambig",
332 uk_dst_calc::local_is_dst(uk_amgbig1.date(),uk_amgbig1.time_of_day())==boost::date_time::ambiguous);
333 check("uk check if time is dst -- ambig",
334 uk_dst_calc::local_is_dst(uk_amgbig2.date(),uk_amgbig2.time_of_day())==boost::date_time::ambiguous);
335 check("uk check if time is dst -- not",
336 uk_dst_calc::local_is_dst(uk_notdst2.date(),uk_notdst2.time_of_day())==boost::date_time::is_not_in_dst);
337
338
339 // /******************** post release 1 -- new dst calc engine ********/
340
341 // //Define dst rule for Paraguay which is transitions forward on Oct 1 and back Mar 1
342
343 typedef boost::date_time::dst_calc_engine<date, time_duration,
344 paraguay_dst_traits> pg_dst_calc;
345
346 {
347
348 date pg_dst_start(2002,Oct, 1);
349 date pg_dst_end(2002,Mar, 1);
350 date pg_indst(2002,Dec, 1);
351 date pg_notdst(2002,Jul, 1);
352 ptime pg_invalid1(pg_dst_start, time_duration(2,0,0)); //invalid time label
353 ptime pg_invalid2(pg_dst_start, time_duration(2,59,59)); //invalid time label
354 ptime pg_notdst1(pg_dst_start, time_duration(1,59,59)); //not ds
355 ptime pg_isdst1(pg_dst_start, time_duration(3,0,0)); //always dst
356 ptime pg_isdst2(pg_dst_end, time_duration(0,59,59)); //is dst
357 ptime pg_amgbig1(pg_dst_end, time_duration(1,0,0)); //ambiguous
358 ptime pg_amgbig2(pg_dst_end, time_duration(1,59,59)); //ambiguous
359 ptime pg_notdst2(pg_dst_end, time_duration(2,0,0)); //always not dst
360
361 check("pg dst start", pg_dst_calc::local_dst_start_day(2002) == pg_dst_start);
362 check("pg dst end", pg_dst_calc::local_dst_end_day(2002) == pg_dst_end);
363 check("pg dst boundary", pg_dst_calc::is_dst_boundary_day(pg_dst_start));
364 check("pg dst boundary", pg_dst_calc::is_dst_boundary_day(pg_dst_end));
365 // on forward shift boundaries
366 check("pg label on dst boundary invalid",
367 pg_dst_calc::local_is_dst(pg_invalid1.date(),pg_invalid1.time_of_day())==boost::date_time::invalid_time_label);
368 check("pg label on dst boundary invalid",
369 pg_dst_calc::local_is_dst(pg_invalid2.date(),pg_invalid2.time_of_day())==boost::date_time::invalid_time_label);
370 check("pg check if time is dst -- not",
371 pg_dst_calc::local_is_dst(pg_notdst1.date(),pg_notdst1.time_of_day())==boost::date_time::is_not_in_dst);
372 check("check if time is dst -- yes",
373 pg_dst_calc::local_is_dst(pg_isdst1.date(),pg_isdst1.time_of_day())==boost::date_time::is_in_dst);
374 //backward shift boundary
375 check("pg check if time is dst -- yes",
376 pg_dst_calc::local_is_dst(pg_isdst2.date(),pg_isdst2.time_of_day())==boost::date_time::is_in_dst);
377 check("pg check if time is dst -- ambig",
378 pg_dst_calc::local_is_dst(pg_amgbig1.date(),pg_amgbig1.time_of_day())==boost::date_time::ambiguous);
379 check("pg check if time is dst -- ambig",
380 pg_dst_calc::local_is_dst(pg_amgbig2.date(),pg_amgbig2.time_of_day())==boost::date_time::ambiguous);
381 check("pg check if time is dst -- not",
382 pg_dst_calc::local_is_dst(pg_notdst2.date(),pg_notdst2.time_of_day())==boost::date_time::is_not_in_dst);
383 // a couple not on the boudnary
384 check("pg check if time is dst -- yes",
385 pg_dst_calc::local_is_dst(pg_indst,time_duration(0,0,0))==boost::date_time::is_in_dst);
386 check("pg check if time is dst -- not",
387 pg_dst_calc::local_is_dst(pg_notdst,time_duration(0,0,0))==boost::date_time::is_not_in_dst);
388
389 }
390
391 // /******************** post release 1 -- new dst calc engine ********/
392
393 // //Define dst rule for Adelaide australia
394
395 typedef boost::date_time::acst_dst_trait<date> acst_dst_traits;
396 typedef boost::date_time::dst_calc_engine<date, time_duration,
397 acst_dst_traits> acst_dst_calc;
398
399 {
400
401 date acst_dst_start(2002,Oct, 27);
402 date acst_dst_end(2002,Mar, 31);
403 date acst_indst(2002,Dec, 1);
404 date acst_notdst(2002,Jul, 1);
405 ptime acst_invalid1(acst_dst_start, time_duration(2,0,0)); //invalid time label
406 ptime acst_invalid2(acst_dst_start, time_duration(2,59,59)); //invalid time label
407 ptime acst_notdst1(acst_dst_start, time_duration(1,59,59)); //not ds
408 ptime acst_isdst1(acst_dst_start, time_duration(3,0,0)); //always dst
409 ptime acst_isdst2(acst_dst_end, time_duration(1,59,59)); //is dst
410 ptime acst_amgbig1(acst_dst_end, time_duration(2,0,0)); //ambiguous
411 ptime acst_amgbig2(acst_dst_end, time_duration(2,59,59)); //ambiguous
412 ptime acst_notdst2(acst_dst_end, time_duration(3,0,0)); //always not dst
413
414 // std::cout << "acst dst_start: " << acst_dst_calc::local_dst_start_day(2002)
415 // << std::endl;
416 check("acst dst start", acst_dst_calc::local_dst_start_day(2002) == acst_dst_start);
417 check("acst dst end", acst_dst_calc::local_dst_end_day(2002) == acst_dst_end);
418 check("acst dst boundary", acst_dst_calc::is_dst_boundary_day(acst_dst_start));
419 check("acst dst boundary", acst_dst_calc::is_dst_boundary_day(acst_dst_end));
420 // on forward shift boundaries
421 check("acst label on dst boundary invalid",
422 acst_dst_calc::local_is_dst(acst_invalid1.date(),acst_invalid1.time_of_day())==boost::date_time::invalid_time_label);
423 check("acst label on dst boundary invalid",
424 acst_dst_calc::local_is_dst(acst_invalid2.date(),acst_invalid2.time_of_day())==boost::date_time::invalid_time_label);
425 check("acst check if time is dst -- not",
426 acst_dst_calc::local_is_dst(acst_notdst1.date(),acst_notdst1.time_of_day())==boost::date_time::is_not_in_dst);
427 check("check if time is dst -- yes",
428 acst_dst_calc::local_is_dst(acst_isdst1.date(),acst_isdst1.time_of_day())==boost::date_time::is_in_dst);
429 //backward shift boundary
430 check("acst check if time is dst -- yes",
431 acst_dst_calc::local_is_dst(acst_isdst2.date(),acst_isdst2.time_of_day())==boost::date_time::is_in_dst);
432 check("acst check if time is dst -- ambig",
433 acst_dst_calc::local_is_dst(acst_amgbig1.date(),acst_amgbig1.time_of_day())==boost::date_time::ambiguous);
434 check("acst check if time is dst -- ambig",
435 acst_dst_calc::local_is_dst(acst_amgbig2.date(),acst_amgbig2.time_of_day())==boost::date_time::ambiguous);
436 check("acst check if time is dst -- not",
437 acst_dst_calc::local_is_dst(acst_notdst2.date(),acst_notdst2.time_of_day())==boost::date_time::is_not_in_dst);
438 // a couple not on the boudnary
439 check("acst check if time is dst -- yes",
440 acst_dst_calc::local_is_dst(acst_indst,time_duration(0,0,0))==boost::date_time::is_in_dst);
441 check("acst check if time is dst -- not",
442 acst_dst_calc::local_is_dst(acst_notdst,time_duration(0,0,0))==boost::date_time::is_not_in_dst);
443 // ptime utc_t = ptime(acst_dst_start, hours(2)) - time_duration(16,30,0);
444 // std::cout << "UTC date/time of Adelaide switch over: " << utc_t << std::endl;
445
446 }
447
448 return printTestStats();
449
450 }
451