1<?php
2
3/*
4 * Note: test names match method names in a set of PHPUnit tests
5 * in a userland package.  Please be so kind as to leave them.
6 */
7
8date_default_timezone_set('America/New_York');
9
10
11/*
12 * Time, Fall, Zone Type 2 to Zone Type 2
13 *
14 * + prev: the day before the transition day  2010-11-06 18:38:28 EDT
15 * + dt: daylight time on transition day      2010-11-07 00:10:20 EDT
16 * + redodt: daylight time in the redo period 2010-11-07 01:12:33 EDT
17 * + redost: standard time in the redo period 2010-11-07 01:14:44 EST
18 * + st: standard time on the transition day  2010-11-07 03:16:55 EST
19 * + post: the day after the transition day   2010-11-08 19:59:59 EST
20 * + dtsec: daylight time 1 sec before change 2010-11-07 01:59:59 EDT
21 * + stsec: standard time first second        2010-11-07 01:00:00 EST
22 */
23echo "test_time_fall_type2_prev_type2_prev: ";
24$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
25$start = new DateTime('2010-10-04 02:18:48 EDT');  // sp prev, zt2
26examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 33);
27
28echo "test_time_fall_type2_prev_type2_dt: ";
29$end   = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
30$start = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
31examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
32
33echo "test_time_fall_type2_prev_type2_redodt: ";
34$end   = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
35$start = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
36examine_diff($end, $start, 'P+0Y0M0DT6H34M5S', 0);
37
38echo "test_time_fall_type2_prev_type2_redost: ";
39$end   = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
40$start = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
41examine_diff($end, $start, 'P+0Y0M0DT7H36M16S', 0);
42
43echo "test_time_fall_type2_prev_type2_st: ";
44$end   = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
45$start = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
46examine_diff($end, $start, 'P+0Y0M0DT9H38M27S', 0);
47
48echo "test_time_fall_type2_prev_type2_post: ";
49$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
50$start = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
51examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
52
53echo "test_time_fall_type2_dt_type2_prev: ";
54$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
55$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
56examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
57
58echo "test_time_fall_type2_dt_type2_dt: ";
59$end   = new DateTime('2010-11-07 00:15:35 EDT');  // sp dt, zt2
60$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
61examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
62
63echo "test_time_fall_type2_dt_type2_redodt: ";
64$end   = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
65$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
66examine_diff($end, $start, 'P+0Y0M0DT1H2M13S', 0);
67
68echo "test_time_fall_type2_dt_type2_redost: ";
69$end   = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
70$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
71examine_diff($end, $start, 'P+0Y0M0DT2H4M24S', 0);
72
73echo "test_time_fall_type2_dt_type2_st: ";
74$end   = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
75$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
76examine_diff($end, $start, 'P+0Y0M0DT4H6M35S', 0);
77
78echo "test_time_fall_type2_dt_type2_post: ";
79$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
80$start = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
81examine_diff($end, $start, 'P+0Y0M1DT20H49M39S', 1);
82
83echo "test_time_fall_type2_redodt_type2_prev: ";
84$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
85$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
86examine_diff($end, $start, 'P-0Y0M0DT6H34M5S', 0);
87
88echo "test_time_fall_type2_redodt_type2_dt: ";
89$end   = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
90$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
91examine_diff($end, $start, 'P-0Y0M0DT1H2M13S', 0);
92
93echo "test_time_fall_type2_redodt_type2_redodt: ";
94$end   = new DateTime('2010-11-07 01:15:35 EDT');  // sp redodt, zt2
95$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
96examine_diff($end, $start, 'P+0Y0M0DT0H3M2S', 0);
97
98echo "test_time_fall_type2_redodt_type2_redost: ";
99$end   = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
100$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
101examine_diff($end, $start, 'P+0Y0M0DT1H2M11S', 0);
102
103echo "test_time_fall_type2_redodt_type2_st: ";
104$end   = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
105$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
106examine_diff($end, $start, 'P+0Y0M0DT3H4M22S', 0);
107
108echo "test_time_fall_type2_redodt_type2_post: ";
109$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
110$start = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
111examine_diff($end, $start, 'P+0Y0M1DT19H47M26S', 1);
112
113echo "test_time_fall_type2_redost_type2_prev: ";
114$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
115$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
116examine_diff($end, $start, 'P-0Y0M0DT7H36M16S', 0);
117
118echo "test_time_fall_type2_redost_type2_dt: ";
119$end   = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
120$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
121examine_diff($end, $start, 'P-0Y0M0DT2H4M24S', 0);
122
123echo "test_time_fall_type2_redost_type2_redodt: ";
124$end   = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
125$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
126examine_diff($end, $start, 'P-0Y0M0DT1H2M11S', 0);
127
128echo "test_time_fall_type2_redost_type2_redost: ";
129$end   = new DateTime('2010-11-07 01:16:54 EST');  // sp redodt, zt2
130$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
131examine_diff($end, $start, 'P+0Y0M0DT0H2M10S', 0);
132
133echo "test_time_fall_type2_redost_type2_st: ";
134$end   = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
135$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
136examine_diff($end, $start, 'P+0Y0M0DT2H2M11S', 0);
137
138echo "test_time_fall_type2_redost_type2_post: ";
139$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
140$start = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
141examine_diff($end, $start, 'P+0Y0M1DT18H45M15S', 1);
142
143echo "test_time_fall_type2_st_type2_prev: ";
144$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
145$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
146examine_diff($end, $start, 'P-0Y0M0DT9H38M27S', 0);
147
148echo "test_time_fall_type2_st_type2_dt: ";
149$end   = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
150$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
151examine_diff($end, $start, 'P-0Y0M0DT4H6M35S', 0);
152
153echo "test_time_fall_type2_st_type2_redodt: ";
154$end   = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
155$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
156examine_diff($end, $start, 'P-0Y0M0DT3H4M22S', 0);
157
158echo "test_time_fall_type2_st_type2_redost: ";
159$end   = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
160$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
161examine_diff($end, $start, 'P-0Y0M0DT2H2M11S', 0);
162
163echo "test_time_fall_type2_st_type2_st: ";
164$end   = new DateTime('2010-11-07 05:19:56 EST');  // sp st, zt2
165$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
166examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
167
168echo "test_time_fall_type2_st_type2_post: ";
169$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
170$start = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
171examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
172
173echo "test_time_fall_type2_post_type2_prev: ";
174$end   = new DateTime('2010-11-06 18:38:28 EDT');  // prev, zt2
175$start = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
176examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
177
178echo "test_time_fall_type2_post_type2_dt: ";
179$end   = new DateTime('2010-11-07 00:10:20 EDT');  // dt, zt2
180$start = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
181examine_diff($end, $start, 'P-0Y0M1DT20H49M39S', 1);
182
183echo "test_time_fall_type2_post_type2_redodt: ";
184$end   = new DateTime('2010-11-07 01:12:33 EDT');  // redodt, zt2
185$start = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
186examine_diff($end, $start, 'P-0Y0M1DT19H47M26S', 1);
187
188echo "test_time_fall_type2_post_type2_redost: ";
189$end   = new DateTime('2010-11-07 01:14:44 EST');  // redost, zt2
190$start = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
191examine_diff($end, $start, 'P-0Y0M1DT18H45M15S', 1);
192
193echo "test_time_fall_type2_post_type2_st: ";
194$end   = new DateTime('2010-11-07 03:16:55 EST');  // st, zt2
195$start = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
196examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
197
198echo "test_time_fall_type2_post_type2_post: ";
199$end   = new DateTime('2010-11-08 19:59:59 EST');  // post, zt2
200$start = new DateTime('2010-11-08 18:57:55 EST');  // sp post, zt2
201examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
202
203echo "test_time_fall_type2_dtsec_type2_stsec: ";
204$end   = new DateTime('2010-11-07 01:00:00 EST');  // stsec, zt2
205$start = new DateTime('2010-11-07 01:59:59 EDT');  // dtsec, zt2
206examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
207
208echo "test_time_fall_type2_stsec_type2_dtsec: ";
209$end   = new DateTime('2010-11-07 01:59:59 EDT');  // dtsec, zt2
210$start = new DateTime('2010-11-07 01:00:00 EST');  // stsec, zt2
211examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
212