← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 17:10:45 2013
Reported on Tue Oct 15 17:11:22 2013

Filename/usr/lib/perl5/Date/Calc.pm
StatementsExecuted 17 statements in 1.42ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111193µs193µsDate::Calc::::bootstrapDate::Calc::bootstrap (xsub)
11122µs22µsDate::Calc::::BEGIN@14Date::Calc::BEGIN@14
11111µs16µsDate::Calc::::BEGIN@15Date::Calc::BEGIN@15
1119µs95µsDate::Calc::::BEGIN@16Date::Calc::BEGIN@16
0000s0sDate::Calc::::Decode_Date_EU2Date::Calc::Decode_Date_EU2
0000s0sDate::Calc::::Decode_Date_US2Date::Calc::Decode_Date_US2
0000s0sDate::Calc::::Parse_DateDate::Calc::Parse_Date
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2###############################################################################
3## ##
4## Copyright (c) 1995 - 2009 by Steffen Beyer. ##
5## All rights reserved. ##
6## ##
7## This package is free software; you can redistribute it ##
8## and/or modify it under the same terms as Perl itself. ##
9## ##
10###############################################################################
11
12package Date::Calc;
13
14237µs122µs
# spent 22µs within Date::Calc::BEGIN@14 which was called: # once (22µs+0s) by C4::Dates::BEGIN@29 at line 14
BEGIN { eval { require bytes; }; }
# spent 22µs making 1 call to Date::Calc::BEGIN@14
15336µs222µs
# spent 16µs (11+5) within Date::Calc::BEGIN@15 which was called: # once (11µs+5µs) by C4::Dates::BEGIN@29 at line 15
use strict;
# spent 16µs making 1 call to Date::Calc::BEGIN@15 # spent 5µs making 1 call to strict::import
1631.27ms2181µs
# spent 95µs (9+86) within Date::Calc::BEGIN@16 which was called: # once (9µs+86µs) by C4::Dates::BEGIN@29 at line 16
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
# spent 95µs making 1 call to Date::Calc::BEGIN@16 # spent 86µs making 1 call to vars::import
17
181900nsrequire Exporter;
191800nsrequire DynaLoader;
20
21117µs@ISA = qw(Exporter DynaLoader);
22
231400ns@EXPORT = qw();
24
25116µs@EXPORT_OK = qw(
26 Days_in_Year
27 Days_in_Month
28 Weeks_in_Year
29 leap_year
30 check_date
31 check_time
32 check_business_date
33 Day_of_Year
34 Date_to_Days
35 Day_of_Week
36 Week_Number
37 Week_of_Year
38 Monday_of_Week
39 Nth_Weekday_of_Month_Year
40 Standard_to_Business
41 Business_to_Standard
42 Delta_Days
43 Delta_DHMS
44 Delta_YMD
45 Delta_YMDHMS
46 N_Delta_YMD
47 N_Delta_YMDHMS
48 Normalize_DHMS
49 Add_Delta_Days
50 Add_Delta_DHMS
51 Add_Delta_YM
52 Add_Delta_YMD
53 Add_Delta_YMDHMS
54 Add_N_Delta_YMD
55 Add_N_Delta_YMDHMS
56 System_Clock
57 Today
58 Now
59 Today_and_Now
60 This_Year
61 Gmtime
62 Localtime
63 Mktime
64 Timezone
65 Date_to_Time
66 Time_to_Date
67 Easter_Sunday
68 Decode_Month
69 Decode_Day_of_Week
70 Decode_Language
71 Decode_Date_EU
72 Decode_Date_US
73 Fixed_Window
74 Moving_Window
75 Compress
76 Uncompress
77 check_compressed
78 Compressed_to_Text
79 Date_to_Text
80 Date_to_Text_Long
81 English_Ordinal
82 Calendar
83 Month_to_Text
84 Day_of_Week_to_Text
85 Day_of_Week_Abbreviation
86 Language_to_Text
87 Language
88 Languages
89 Decode_Date_EU2
90 Decode_Date_US2
91 Parse_Date
92 ISO_LC
93 ISO_UC
94);
95
96113µs%EXPORT_TAGS = (all => [@EXPORT_OK]);
97
98##################################################
99## ##
100## "Version()" is available but not exported ##
101## in order to avoid possible name clashes. ##
102## Call with "Date::Calc::Version()" instead! ##
103## ##
104##################################################
105
1061500ns$VERSION = '6.0';
107
10819µs1531µsbootstrap Date::Calc $VERSION;
# spent 531µs making 1 call to DynaLoader::bootstrap
109
110sub Decode_Date_EU2
111{
112 die "Usage: (\$year,\$month,\$day) = Decode_Date_EU2(\$date[,\$lang]);\n"
113 unless ((@_ == 1) or (@_ == 2));
114
115 my($buffer) = shift;
116 my($lang) = shift || 0;
117 my($year,$month,$day,$length);
118
119 $lang = Language() unless (($lang >= 1) and ($lang <= Languages()));
120 if ($buffer =~ /^\D* (\d+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* (\d+) \D*$/x)
121 {
122 ($day,$month,$year) = ($1,$2,$3);
123 $month = Decode_Month($month,$lang);
124 unless ($month > 0)
125 {
126 return(); # can't decode month!
127 }
128 }
129 elsif ($buffer =~ /^\D* 0*(\d+) \D*$/x)
130 {
131 $buffer = $1;
132 $length = length($buffer);
133 if ($length == 3)
134 {
135 $day = substr($buffer,0,1);
136 $month = substr($buffer,1,1);
137 $year = substr($buffer,2,1);
138 }
139 elsif ($length == 4)
140 {
141 $day = substr($buffer,0,1);
142 $month = substr($buffer,1,1);
143 $year = substr($buffer,2,2);
144 }
145 elsif ($length == 5)
146 {
147 $day = substr($buffer,0,1);
148 $month = substr($buffer,1,2);
149 $year = substr($buffer,3,2);
150 }
151 elsif ($length == 6)
152 {
153 $day = substr($buffer,0,2);
154 $month = substr($buffer,2,2);
155 $year = substr($buffer,4,2);
156 }
157 elsif ($length == 7)
158 {
159 $day = substr($buffer,0,1);
160 $month = substr($buffer,1,2);
161 $year = substr($buffer,3,4);
162 }
163 elsif ($length == 8)
164 {
165 $day = substr($buffer,0,2);
166 $month = substr($buffer,2,2);
167 $year = substr($buffer,4,4);
168 }
169 else { return(); } # wrong number of digits!
170 }
171 elsif ($buffer =~ /^\D* (\d+) \D+ (\d+) \D+ (\d+) \D*$/x)
172 {
173 ($day,$month,$year) = ($1,$2,$3);
174 }
175 else { return(); } # no match at all!
176 $year = Moving_Window($year);
177 if (check_date($year,$month,$day))
178 {
179 return($year,$month,$day);
180 }
181 else { return(); } # not a valid date!
182}
183
184sub Decode_Date_US2
185{
186 die "Usage: (\$year,\$month,\$day) = Decode_Date_US2(\$date[,\$lang]);\n"
187 unless ((@_ == 1) or (@_ == 2));
188
189 my($buffer) = shift;
190 my($lang) = shift || 0;
191 my($year,$month,$day,$length);
192
193 $lang = Language() unless (($lang >= 1) and ($lang <= Languages()));
194 if ($buffer =~ /^[^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* 0*(\d+) \D*$/x)
195 {
196 ($month,$buffer) = ($1,$2);
197 $month = Decode_Month($month,$lang);
198 unless ($month > 0)
199 {
200 return(); # can't decode month!
201 }
202 $length = length($buffer);
203 if ($length == 2)
204 {
205 $day = substr($buffer,0,1);
206 $year = substr($buffer,1,1);
207 }
208 elsif ($length == 3)
209 {
210 $day = substr($buffer,0,1);
211 $year = substr($buffer,1,2);
212 }
213 elsif ($length == 4)
214 {
215 $day = substr($buffer,0,2);
216 $year = substr($buffer,2,2);
217 }
218 elsif ($length == 5)
219 {
220 $day = substr($buffer,0,1);
221 $year = substr($buffer,1,4);
222 }
223 elsif ($length == 6)
224 {
225 $day = substr($buffer,0,2);
226 $year = substr($buffer,2,4);
227 }
228 else { return(); } # wrong number of digits!
229 }
230 elsif ($buffer =~ /^[^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* ([A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\xFF]+) [^A-Za-z0-9\xC0-\xD6\xD8-\xF6\xF8-\xFF]* (\d+) \D+ (\d+) \D*$/x)
231 {
232 ($month,$day,$year) = ($1,$2,$3);
233 $month = Decode_Month($month,$lang);
234 unless ($month > 0)
235 {
236 return(); # can't decode month!
237 }
238 }
239 elsif ($buffer =~ /^\D* 0*(\d+) \D*$/x)
240 {
241 $buffer = $1;
242 $length = length($buffer);
243 if ($length == 3)
244 {
245 $month = substr($buffer,0,1);
246 $day = substr($buffer,1,1);
247 $year = substr($buffer,2,1);
248 }
249 elsif ($length == 4)
250 {
251 $month = substr($buffer,0,1);
252 $day = substr($buffer,1,1);
253 $year = substr($buffer,2,2);
254 }
255 elsif ($length == 5)
256 {
257 $month = substr($buffer,0,1);
258 $day = substr($buffer,1,2);
259 $year = substr($buffer,3,2);
260 }
261 elsif ($length == 6)
262 {
263 $month = substr($buffer,0,2);
264 $day = substr($buffer,2,2);
265 $year = substr($buffer,4,2);
266 }
267 elsif ($length == 7)
268 {
269 $month = substr($buffer,0,1);
270 $day = substr($buffer,1,2);
271 $year = substr($buffer,3,4);
272 }
273 elsif ($length == 8)
274 {
275 $month = substr($buffer,0,2);
276 $day = substr($buffer,2,2);
277 $year = substr($buffer,4,4);
278 }
279 else { return(); } # wrong number of digits!
280 }
281 elsif ($buffer =~ /^\D* (\d+) \D+ (\d+) \D+ (\d+) \D*$/x)
282 {
283 ($month,$day,$year) = ($1,$2,$3);
284 }
285 else { return(); } # no match at all!
286 $year = Moving_Window($year);
287 if (check_date($year,$month,$day))
288 {
289 return($year,$month,$day);
290 }
291 else { return(); } # not a valid date!
292}
293
294sub Parse_Date
295{
296 die "Usage: (\$year,\$month,\$day) = Parse_Date(\$date[,\$lang]);\n"
297 unless ((@_ == 1) or (@_ == 2));
298
299 my($date) = shift;
300 my($lang) = shift || 0;
301 my($year,$month,$day);
302
303 $lang = Language() unless (($lang >= 1) and ($lang <= Languages()));
304 unless ($date =~ /\b([\x41-\x5A\x61-\x7A\xC0-\xD6\xD8-\xF6\xF8-\xFF]{3})\s+([0123]??\d)\b/)
305 {
306 return();
307 }
308 $month = $1;
309 $day = $2;
310 unless ($date =~ /\b(19\d\d|20\d\d)\b/)
311 {
312 return();
313 }
314 $year = $1;
315 $month = Decode_Month($month,$lang);
316 unless ($month > 0)
317 {
318 return();
319 }
320 unless (check_date($year,$month,$day))
321 {
322 return();
323 }
324 return($year,$month,$day);
325}
326
327114µs1;
328
329__END__
 
# spent 193µs within Date::Calc::bootstrap which was called: # once (193µs+0s) by DynaLoader::bootstrap at line 215 of DynaLoader.pm
sub Date::Calc::bootstrap; # xsub