1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135
|
#!/usr/bin/perl
use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";
our $obj = new Date::Manip::TZ;
$obj->config("forcedate","now,America/New_York");
sub test {
my(@test)=@_;
my $per = $obj->date_period(@test);
return () if (! $per);
return @$per;
}
my $tests="
[ 1 2 1 0 0 0 ] America/New_York 0 =>
[ 1 1 2 0 0 0 ]
[ 1 1 1 19 3 58 ]
-04:56:02
[ -4 -56 -2 ]
LMT
0
[ 1883 11 18 16 59 59 ]
[ 1883 11 18 12 3 57 ]
0001010200:00:00
0001010119:03:58
1883111816:59:59
1883111812:03:57
[ 1880 1 1 0 0 0 ] America/New_York 0 =>
[ 1 1 2 0 0 0 ]
[ 1 1 1 19 3 58 ]
-04:56:02
[ -4 -56 -2 ]
LMT
0
[ 1883 11 18 16 59 59 ]
[ 1883 11 18 12 3 57 ]
0001010200:00:00
0001010119:03:58
1883111816:59:59
1883111812:03:57
[ 1925 9 27 6 0 0 ] America/New_York 0 =>
[ 1925 9 27 6 0 0 ]
[ 1925 9 27 1 0 0 ]
-05:00:00
[ -5 0 0 ]
EST
0
[ 1926 4 25 6 59 59 ]
[ 1926 4 25 1 59 59 ]
1925092706:00:00
1925092701:00:00
1926042506:59:59
1926042501:59:59
[ 1925 9 27 1 0 0 ] America/New_York 1 0 =>
[ 1925 9 27 6 0 0 ]
[ 1925 9 27 1 0 0 ]
-05:00:00
[ -5 0 0 ]
EST
0
[ 1926 4 25 6 59 59 ]
[ 1926 4 25 1 59 59 ]
1925092706:00:00
1925092701:00:00
1926042506:59:59
1926042501:59:59
[ 1926 4 25 2 15 0 ] America/New_York 1 0 =>
[ 1926 4 25 3 15 0 ] America/New_York 1 0 =>
[ 1926 4 25 7 0 0 ]
[ 1926 4 25 3 0 0 ]
-04:00:00
[ -4 0 0 ]
EDT
1
[ 1926 9 26 5 59 59 ]
[ 1926 9 26 1 59 59 ]
1926042507:00:00
1926042503:00:00
1926092605:59:59
1926092601:59:59
[ 1926 9 26 1 15 0 ] America/New_York 1 0 =>
[ 1926 9 26 6 0 0 ]
[ 1926 9 26 1 0 0 ]
-05:00:00
[ -5 0 0 ]
EST
0
[ 1927 4 24 6 59 59 ]
[ 1927 4 24 1 59 59 ]
1926092606:00:00
1926092601:00:00
1927042406:59:59
1927042401:59:59
[ 1926 9 26 1 15 0 ] America/New_York 1 1 =>
[ 1926 4 25 7 0 0 ]
[ 1926 4 25 3 0 0 ]
-04:00:00
[ -4 0 0 ]
EDT
1
[ 1926 9 26 5 59 59 ]
[ 1926 9 26 1 59 59 ]
1926042507:00:00
1926042503:00:00
1926092605:59:59
1926092601:59:59
";
$::ti->tests(func => \&test,
tests => $tests);
$::ti->done_testing();
#Local Variables:
#mode: cperl
#indent-tabs-mode: nil
#cperl-indent-level: 3
#cperl-continued-statement-offset: 2
#cperl-continued-brace-offset: 0
#cperl-brace-offset: 0
#cperl-brace-imaginary-offset: 0
#cperl-label-offset: 0
#End:
|