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