File: base._critical_date.t

package info (click to toggle)
libdate-manip-perl 6.98-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,928 kB
  • sloc: perl: 222,846; sh: 54; ansic: 26; makefile: 8
file content (180 lines) | stat: -rwxr-xr-x 7,029 bytes parent folder | download | duplicates (3)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#!/usr/bin/perl

use warnings;
use strict;
use Test::Inter;
$::ti = new Test::Inter $0;
require "tests.pl";

our $dmt = new Date::Manip::TZ;
our $obj = $dmt->base();
$dmt->config("forcedate","now,America/New_York");

sub test {
   my(@test)=@_;
   my @ret = $obj->_critical_date(@test);
   return @ret;
}

#################################################################################
# Rule    Syria   2008    max     -       Apr     Fri>=1  0:00    1:00    S
# Rule    Syria   2008    max     -       Oct     1       0:00    0       -

# Zone    Asia/Damascus   2:25:12 -       LMT     1920    # Dimashq
#                         2:00    Syria   EE%sT

# Asia/Damascus  Apr  1 21:59:59 2038 UTC = Thu Apr  1 23:59:59 2038 EET isdst=0
# Asia/Damascus  Apr  1 22:00:00 2038 UTC = Fri Apr  2 01:00:00 2038 EEST isdst=1
# Asia/Damascus  Sep 30 20:59:59 2038 UTC = Thu Sep 30 23:59:59 2038 EEST isdst=1
# Asia/Damascus  Sep 30 21:00:00 2038 UTC = Thu Sep 30 23:00:00 2038 EET isdst=0
# Asia/Damascus  Mar 31 21:59:59 2039 UTC = Thu Mar 31 23:59:59 2039 EET isdst=0
# Asia/Damascus  Mar 31 22:00:00 2039 UTC = Fri Apr  1 01:00:00 2039 EEST isdst=1
# Asia/Damascus  Sep 30 20:59:59 2039 UTC = Fri Sep 30 23:59:59 2039 EEST isdst=1
# Asia/Damascus  Sep 30 21:00:00 2039 UTC = Fri Sep 30 23:00:00 2039 EET isdst=0
# Asia/Damascus  Apr  5 21:59:59 2040 UTC = Thu Apr  5 23:59:59 2040 EET isdst=0

#################################################################################
# Rule    US      2007    max     -       Mar     Sun>=8  2:00    1:00    D
# Rule    US      2007    max     -       Nov     Sun>=1  2:00    0       S

# Zone America/New_York   -4:56:02 -      LMT     1883 Nov 18 12:03:58
#                         -5:00   US      E%sT    1920
#                         -5:00   NYC     E%sT    1942
#                         -5:00   US      E%sT    1946
#                         -5:00   NYC     E%sT    1967
#                         -5:00   US      E%sT

# America/New_York  Mar  8 06:59:59 2037 UTC = Mar  8 01:59:59 2037 EST isdst=0
# America/New_York  Mar  8 07:00:00 2037 UTC = Mar  8 03:00:00 2037 EDT isdst=1
# America/New_York  Nov  1 05:59:59 2037 UTC = Nov  1 01:59:59 2037 EDT isdst=1
# America/New_York  Nov  1 06:00:00 2037 UTC = Nov  1 01:00:00 2037 EST isdst=0
# America/New_York  Mar 14 06:59:59 2038 UTC = Mar 14 01:59:59 2038 EST isdst=0
# America/New_York  Mar 14 07:00:00 2038 UTC = Mar 14 03:00:00 2038 EDT isdst=1
# America/New_York  Nov  7 05:59:59 2038 UTC = Nov  7 01:59:59 2038 EDT isdst=1
# America/New_York  Nov  7 06:00:00 2038 UTC = Nov  7 01:00:00 2038 EST isdst=0

#################################################################################
# Rule    Egypt   1995    max     -       Apr     lastFri  0:00s  1:00    S
# Rule    Egypt   2008    max     -       Aug     lastThu 23:00s  0       -

# Zone    Africa/Cairo    2:05:00 -       LMT     1900 Oct
#                         2:00    Egypt   EE%sT

# Africa/Cairo  Thu Apr 25 21:59:59 2030 UTC = Thu Apr 25 23:59:59 2030 EET isdst=0
# Africa/Cairo  Thu Apr 25 22:00:00 2030 UTC = Fri Apr 26 01:00:00 2030 EEST isdst=1
# Africa/Cairo  Thu Aug 29 20:59:59 2030 UTC = Thu Aug 29 23:59:59 2030 EEST isdst=1
# Africa/Cairo  Thu Aug 29 21:00:00 2030 UTC = Thu Aug 29 23:00:00 2030 EET isdst=0
# Africa/Cairo  Thu Apr 24 21:59:59 2031 UTC = Thu Apr 24 23:59:59 2031 EET isdst=0

#################################################################################
# Rule    StJohns 2007    max     -       Mar     Sun>=8  0:01    1:00    D
# Rule    StJohns 2007    max     -       Nov     Sun>=1  0:01    0       S

# Zone America/St_Johns   -3:30:52 -      LMT     1884
#                         -3:30:52 StJohns N%sT   1918
#                         -3:30:52 Canada N%sT    1919
#                         -3:30:52 StJohns N%sT   1935 Mar 30
#                         -3:30   StJohns N%sT    1942 May 11
#                         -3:30   Canada  N%sT    1946
#                         -3:30   StJohns N%sT

# America/St_Johns  Mar  8 03:30:59 2037 UTC = Mar  8 00:00:59 2037 NST isdst=0
# America/St_Johns  Mar  8 03:31:00 2037 UTC = Mar  8 01:01:00 2037 NDT isdst=1
# America/St_Johns  Nov  1 02:30:59 2037 UTC = Nov  1 00:00:59 2037 NDT isdst=1
# America/St_Johns  Nov  1 02:31:00 2037 UTC = Oct 31 23:01:00 2037 NST isdst=0

#################################################################################
# Rule    EU      1981    max     -       Mar     lastSun  1:00u  1:00    S
# Rule    EU      1996    max     -       Oct     lastSun  1:00u  0       -

# Zone America/Godthab    -3:26:56 -      LMT     1916 Jul 28 # Nuuk
#                         -3:00   -       WGT     1980 Apr  6 2:00
#                         -3:00   EU      WG%sT

# America/Godthab  Mar 29 00:59:59 2037 UTC = Mar 28 21:59:59 2037 WGT isdst=0
# America/Godthab  Mar 29 01:00:00 2037 UTC = Mar 28 23:00:00 2037 WGST isdst=1
# America/Godthab  Oct 25 00:59:59 2037 UTC = Oct 24 22:59:59 2037 WGST isdst=1
# America/Godthab  Oct 25 01:00:00 2037 UTC = Oct 24 22:00:00 2037 WGT isdst=0

#################################################################################

# YEAR MON FLAG NUM DOW ISDST TIME TIMETYPE STDOFF DSTOFF
my $tests="

2038 04 ge 1 5 1 00:00:00 w 02:00:00 03:00:00 =>
   [ 2038 4 1 21 59 59 ]
   [ 2038 4 1 23 59 59 ]
   [ 2038 4 1 22 0 0 ]
   [ 2038 4 2 1 0 0 ]

2038 10 dom 1 - 0 00:00:00 w 02:00:00 03:00:00 =>
   [ 2038 9 30 20 59 59 ]
   [ 2038 9 30 23 59 59 ]
   [ 2038 9 30 21 0 0 ]
   [ 2038 9 30 23 0 0 ]

2037 03 ge 8 7 1 02:00:00 w -05:00:00 -04:00:00 =>
   [ 2037 3 8 6 59 59 ]
   [ 2037 3 8 1 59 59 ]
   [ 2037 3 8 7 0 0 ]
   [ 2037 3 8 3 0 0 ]

2037 11 ge 1 7 0 02:00:00 w -05:00:00 -04:00:00 =>
   [ 2037 11 1 5 59 59 ]
   [ 2037 11 1 1 59 59 ]
   [ 2037 11 1 6 0 0 ]
   [ 2037 11 1 1 0 0 ]

2030 04 last - 5 1 00:00:00 s 02:00:00 03:00:00 =>
   [ 2030 4 25 21 59 59 ]
   [ 2030 4 25 23 59 59 ]
   [ 2030 4 25 22 0 0 ]
   [ 2030 4 26 1 0 0 ]

2030 08 last - 4 0 23:00:00 s 02:00:00 03:00:00 =>
   [ 2030 8 29 20 59 59 ]
   [ 2030 8 29 23 59 59 ]
   [ 2030 8 29 21 0 0 ]
   [ 2030 8 29 23 0 0 ]

2037 03 ge 8 7 1 00:01:00 w -03:30:00 -02:30:00 =>
   [ 2037 3 8 3 30 59 ]
   [ 2037 3 8 0 0 59 ]
   [ 2037 3 8 3 31 0 ]
   [ 2037 3 8 1 1 0 ]

2037 11 ge 1 7 0 00:01:00 w -03:30:00 -02:30:00 =>
   [ 2037 11 1 2 30 59 ]
   [ 2037 11 1 0 0 59 ]
   [ 2037 11 1 2 31 0 ]
   [ 2037 10 31 23 1 0 ]

2037 03 last - 7 1 01:00:00 u -03:00:00 -02:00:00 =>
   [ 2037 3 29 0 59 59 ]
   [ 2037 3 28 21 59 59 ]
   [ 2037 3 29 1 0 0 ]
   [ 2037 3 28 23 0 0 ]

2037 10 last - 7 0 01:00:00 u -03:00:00 -02:00:00 =>
   [ 2037 10 25 0 59 59 ]
   [ 2037 10 24 22 59 59 ]
   [ 2037 10 25 1 0 0 ]
   [ 2037 10 24 22 0 0 ]

";

$::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: