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, Spring, Zone Type 2 to Zone Type 2
13 *
14 * + prev: the day before the transition day  2010-03-13 18:38:28 EST
15 * + st: standard time on transition day      2010-03-14 00:10:20 EST
16 * + dt: daylight time on the transition day  2010-03-14 03:16:55 EDT
17 * + post: the day after the transition day   2010-03-15 19:59:59 EDT
18 * + stsec: standard time 1 sec before change 2010-03-14 01:59:59 EST
19 * + dtsec: daylight time first second        2010-03-14 03:00:00 EDT
20 */
21echo "test_time_spring_type2_prev_type2_prev: ";
22$end   = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
23$start = new DateTime('2010-02-11 02:18:48 EST');  // sp prev, zt2
24examine_diff($end, $start, 'P+0Y1M2DT16H19M40S', 30);
25
26echo "test_time_spring_type2_prev_type2_st: ";
27$end   = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
28$start = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
29examine_diff($end, $start, 'P+0Y0M0DT5H31M52S', 0);
30
31echo "test_time_spring_type2_prev_type2_dt: ";
32$end   = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
33$start = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
34examine_diff($end, $start, 'P+0Y0M0DT7H38M27S', 0);
35
36echo "test_time_spring_type2_prev_type2_post: ";
37$end   = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
38$start = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
39examine_diff($end, $start, 'P+0Y0M2DT1H21M31S', 2);
40
41echo "test_time_spring_type2_st_type2_prev: ";
42$end   = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
43$start = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
44examine_diff($end, $start, 'P-0Y0M0DT5H31M52S', 0);
45
46echo "test_time_spring_type2_st_type2_st: ";
47$end   = new DateTime('2010-03-14 00:15:35 EST');  // sp st, zt2
48$start = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
49examine_diff($end, $start, 'P+0Y0M0DT0H5M15S', 0);
50
51echo "test_time_spring_type2_st_type2_dt: ";
52$end   = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
53$start = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
54examine_diff($end, $start, 'P+0Y0M0DT2H6M35S', 0);
55
56echo "test_time_spring_type2_st_type2_post: ";
57$end   = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
58$start = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
59examine_diff($end, $start, 'P+0Y0M1DT18H49M39S', 1);
60
61echo "test_time_spring_type2_dt_type2_prev: ";
62$end   = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
63$start = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
64examine_diff($end, $start, 'P-0Y0M0DT7H38M27S', 0);
65
66echo "test_time_spring_type2_dt_type2_st: ";
67$end   = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
68$start = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
69examine_diff($end, $start, 'P-0Y0M0DT2H6M35S', 0);
70
71echo "test_time_spring_type2_dt_type2_dt: ";
72$end   = new DateTime('2010-03-14 05:19:56 EDT');  // sp dt, zt2
73$start = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
74examine_diff($end, $start, 'P+0Y0M0DT2H3M1S', 0);
75
76echo "test_time_spring_type2_dt_type2_post: ";
77$end   = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
78$start = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
79examine_diff($end, $start, 'P+0Y0M1DT16H43M4S', 1);
80
81echo "test_time_spring_type2_post_type2_prev: ";
82$end   = new DateTime('2010-03-13 18:38:28 EST');  // prev, zt2
83$start = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
84examine_diff($end, $start, 'P-0Y0M2DT1H21M31S', 2);
85
86echo "test_time_spring_type2_post_type2_st: ";
87$end   = new DateTime('2010-03-14 00:10:20 EST');  // st, zt2
88$start = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
89examine_diff($end, $start, 'P-0Y0M1DT18H49M39S', 1);
90
91echo "test_time_spring_type2_post_type2_dt: ";
92$end   = new DateTime('2010-03-14 03:16:55 EDT');  // dt, zt2
93$start = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
94examine_diff($end, $start, 'P-0Y0M1DT16H43M4S', 1);
95
96echo "test_time_spring_type2_post_type2_post: ";
97$end   = new DateTime('2010-03-15 19:59:59 EDT');  // post, zt2
98$start = new DateTime('2010-03-15 18:57:55 EDT');  // sp post, zt2
99examine_diff($end, $start, 'P+0Y0M0DT1H2M4S', 0);
100
101echo "test_time_spring_type2_stsec_type2_dtsec: ";
102$end   = new DateTime('2010-03-14 03:00:00 EDT');  // dtsec, zt2
103$start = new DateTime('2010-03-14 01:59:59 EST');  // stsec, zt2
104examine_diff($end, $start, 'P+0Y0M0DT0H0M1S', 0);
105
106echo "test_time_spring_type2_dtsec_type2_stsec: ";
107$end   = new DateTime('2010-03-14 01:59:59 EST');  // stsec, zt2
108$start = new DateTime('2010-03-14 03:00:00 EDT');  // dtsec, zt2
109examine_diff($end, $start, 'P-0Y0M0DT0H0M1S', 0);
110