← Index
NYTProf Performance Profile   « line view »
For /usr/local/libexec/sympa/task_manager-debug.pl
  Run on Tue Jun 1 22:32:51 2021
Reported on Tue Jun 1 22:35:12 2021

Filename/usr/local/lib/perl5/site_perl/Date/Format.pm
StatementsExecuted 0 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sDate::Format::::BEGIN@7 Date::Format::BEGIN@7
0000s0sDate::Format::::BEGIN@8 Date::Format::BEGIN@8
0000s0sDate::Format::Generic::::BEGIN@43Date::Format::Generic::BEGIN@43
0000s0sDate::Format::Generic::::BEGIN@44Date::Format::Generic::BEGIN@44
0000s0sDate::Format::Generic::::BEGIN@45Date::Format::Generic::BEGIN@45
0000s0sDate::Format::Generic::::CORE:openDate::Format::Generic::CORE:open (opcode)
0000s0sDate::Format::Generic::::__ANON__[:65]Date::Format::Generic::__ANON__[:65]
0000s0sDate::Format::Generic::::_subsDate::Format::Generic::_subs
0000s0sDate::Format::Generic::::asctimeDate::Format::Generic::asctime
0000s0sDate::Format::Generic::::ctimeDate::Format::Generic::ctime
0000s0sDate::Format::Generic::::format_ADate::Format::Generic::format_A
0000s0sDate::Format::Generic::::format_BDate::Format::Generic::format_B
0000s0sDate::Format::Generic::::format_CDate::Format::Generic::format_C
0000s0sDate::Format::Generic::::format_DDate::Format::Generic::format_D
0000s0sDate::Format::Generic::::format_GDate::Format::Generic::format_G
0000s0sDate::Format::Generic::::format_HDate::Format::Generic::format_H
0000s0sDate::Format::Generic::::format_IDate::Format::Generic::format_I
0000s0sDate::Format::Generic::::format_LDate::Format::Generic::format_L
0000s0sDate::Format::Generic::::format_MDate::Format::Generic::format_M
0000s0sDate::Format::Generic::::format_OHDate::Format::Generic::format_OH
0000s0sDate::Format::Generic::::format_OIDate::Format::Generic::format_OI
0000s0sDate::Format::Generic::::format_OMDate::Format::Generic::format_OM
0000s0sDate::Format::Generic::::format_OYDate::Format::Generic::format_OY
0000s0sDate::Format::Generic::::format_OdDate::Format::Generic::format_Od
0000s0sDate::Format::Generic::::format_OeDate::Format::Generic::format_Oe
0000s0sDate::Format::Generic::::format_OjDate::Format::Generic::format_Oj
0000s0sDate::Format::Generic::::format_OkDate::Format::Generic::format_Ok
0000s0sDate::Format::Generic::::format_OlDate::Format::Generic::format_Ol
0000s0sDate::Format::Generic::::format_OmDate::Format::Generic::format_Om
0000s0sDate::Format::Generic::::format_OqDate::Format::Generic::format_Oq
0000s0sDate::Format::Generic::::format_OyDate::Format::Generic::format_Oy
0000s0sDate::Format::Generic::::format_PDate::Format::Generic::format_P
0000s0sDate::Format::Generic::::format_RDate::Format::Generic::format_R
0000s0sDate::Format::Generic::::format_SDate::Format::Generic::format_S
0000s0sDate::Format::Generic::::format_TDate::Format::Generic::format_T
0000s0sDate::Format::Generic::::format_UDate::Format::Generic::format_U
0000s0sDate::Format::Generic::::format_WDate::Format::Generic::format_W
0000s0sDate::Format::Generic::::format_XDate::Format::Generic::format_X
0000s0sDate::Format::Generic::::format_YDate::Format::Generic::format_Y
0000s0sDate::Format::Generic::::format_ZDate::Format::Generic::format_Z
0000s0sDate::Format::Generic::::format_aDate::Format::Generic::format_a
0000s0sDate::Format::Generic::::format_bDate::Format::Generic::format_b
0000s0sDate::Format::Generic::::format_cDate::Format::Generic::format_c
0000s0sDate::Format::Generic::::format_dDate::Format::Generic::format_d
0000s0sDate::Format::Generic::::format_eDate::Format::Generic::format_e
0000s0sDate::Format::Generic::::format_hDate::Format::Generic::format_h
0000s0sDate::Format::Generic::::format_jDate::Format::Generic::format_j
0000s0sDate::Format::Generic::::format_kDate::Format::Generic::format_k
0000s0sDate::Format::Generic::::format_lDate::Format::Generic::format_l
0000s0sDate::Format::Generic::::format_mDate::Format::Generic::format_m
0000s0sDate::Format::Generic::::format_nDate::Format::Generic::format_n
0000s0sDate::Format::Generic::::format_oDate::Format::Generic::format_o
0000s0sDate::Format::Generic::::format_pDate::Format::Generic::format_p
0000s0sDate::Format::Generic::::format_qDate::Format::Generic::format_q
0000s0sDate::Format::Generic::::format_rDate::Format::Generic::format_r
0000s0sDate::Format::Generic::::format_sDate::Format::Generic::format_s
0000s0sDate::Format::Generic::::format_tDate::Format::Generic::format_t
0000s0sDate::Format::Generic::::format_wDate::Format::Generic::format_w
0000s0sDate::Format::Generic::::format_xDate::Format::Generic::format_x
0000s0sDate::Format::Generic::::format_yDate::Format::Generic::format_y
0000s0sDate::Format::Generic::::format_zDate::Format::Generic::format_z
0000s0sDate::Format::Generic::::romanDate::Format::Generic::roman
0000s0sDate::Format::Generic::::strftimeDate::Format::Generic::strftime
0000s0sDate::Format::Generic::::time2strDate::Format::Generic::time2str
0000s0sDate::Format::Generic::::wkyrDate::Format::Generic::wkyr
0000s0sDate::Format::::asctime Date::Format::asctime
0000s0sDate::Format::::ctime Date::Format::ctime
0000s0sDate::Format::::strftime Date::Format::strftime
0000s0sDate::Format::::time2str Date::Format::time2str
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# Copyright (c) 1995-2009 Graham Barr. This program is free
2# software; you can redistribute it and/or modify it under the same terms
3# as Perl itself.
4
5package Date::Format;
6
7use strict;
8use vars qw(@EXPORT @ISA $VERSION);
9require Exporter;
10
11$VERSION = "2.24";
12@ISA = qw(Exporter);
13@EXPORT = qw(time2str strftime ctime asctime);
14
15sub time2str ($;$$)
16{
17 Date::Format::Generic->time2str(@_);
18}
19
20sub strftime ($\@;$)
21{
22 Date::Format::Generic->strftime(@_);
23}
24
25sub ctime ($;$)
26{
27 my($t,$tz) = @_;
28 Date::Format::Generic->time2str("%a %b %e %T %Y\n", $t, $tz);
29}
30
31sub asctime (\@;$)
32{
33 my($t,$tz) = @_;
34 Date::Format::Generic->strftime("%a %b %e %T %Y\n", $t, $tz);
35}
36
37##
38##
39##
40
41package Date::Format::Generic;
42
43use vars qw($epoch $tzname);
44use Time::Zone;
45use Time::Local;
46
47sub ctime
48{
49 my($me,$t,$tz) = @_;
50 $me->time2str("%a %b %e %T %Y\n", $t, $tz);
51}
52
53sub asctime
54{
55 my($me,$t,$tz) = @_;
56 $me->strftime("%a %b %e %T %Y\n", $t, $tz);
57}
58
59sub _subs
60{
61 my $fn;
62 $_[1] =~ s/
63 ($_[0]->can("format_$1") || sub { $1 })->($_[0]);
64 /sgeox;
65
- -
68 $_[1];
69}
70
71sub strftime
72{
73 my($pkg,$fmt,$time);
74
75 ($pkg,$fmt,$time,$tzname) = @_;
76
77 my $me = ref($pkg) ? $pkg : bless [];
78
79 if(defined $tzname)
80 {
81 $tzname = uc $tzname;
82
83 $tzname = sprintf("%+05d",$tzname)
84 unless($tzname =~ /\D/);
85
86 $epoch = timegm(@{$time}[0..5]);
87
88 @$me = gmtime($epoch + tz_offset($tzname) - tz_offset());
89 }
90 else
91 {
92 @$me = @$time;
93 undef $epoch;
94 }
95
96 _subs($me,$fmt);
97}
98
99sub time2str
100{
101 my($pkg,$fmt,$time);
102
103 ($pkg,$fmt,$time,$tzname) = @_;
104
105 my $me = ref($pkg) ? $pkg : bless [], $pkg;
106
107 $epoch = $time;
108
109 if(defined $tzname)
110 {
111 $tzname = uc $tzname;
112
113 $tzname = sprintf("%+05d",$tzname)
114 unless($tzname =~ /\D/);
115
116 $time += tz_offset($tzname);
117 @$me = gmtime($time);
118 }
119 else
120 {
121 @$me = localtime($time);
122 }
123 $me->[9] = $time;
124 _subs($me,$fmt);
125}
126
127my(@DoW,@MoY,@DoWs,@MoYs,@AMPM,%format,@Dsuf);
128
129@DoW = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
130
131@MoY = qw(January February March April May June
132 July August September October November December);
133
134@DoWs = map { substr($_,0,3) } @DoW;
135@MoYs = map { substr($_,0,3) } @MoY;
136
137@AMPM = qw(AM PM);
138
139@Dsuf = (qw(th st nd rd th th th th th th)) x 3;
140@Dsuf[11,12,13] = qw(th th th);
141@Dsuf[30,31] = qw(th st);
142
143%format = ('x' => "%m/%d/%y",
144 'C' => "%a %b %e %T %Z %Y",
145 'X' => "%H:%M:%S",
146 );
147
148my @locale;
149my $locale = "/usr/share/lib/locale/LC_TIME/default";
150local *LOCALE;
151
152if(open(LOCALE,"$locale"))
153 {
154 chop(@locale = <LOCALE>);
155 close(LOCALE);
156
157 @MoYs = @locale[0 .. 11];
158 @MoY = @locale[12 .. 23];
159 @DoWs = @locale[24 .. 30];
160 @DoW = @locale[31 .. 37];
161 @format{"X","x","C"} = @locale[38 .. 40];
162 @AMPM = @locale[41 .. 42];
163 }
164
165sub wkyr {
166 my($wstart, $wday, $yday) = @_;
167 $wday = ($wday + 7 - $wstart) % 7;
168 return int(($yday - $wday + 13) / 7 - 1);
169}
170
171##
172## these 6 formatting routins need to be *copied* into the language
173## specific packages
174##
175
176my @roman = ('',qw(I II III IV V VI VII VIII IX));
177sub roman {
178 my $n = shift;
179
180 $n =~ s/(\d)$//;
181 my $r = $roman[ $1 ];
182
183 if($n =~ s/(\d)$//) {
184 (my $t = $roman[$1]) =~ tr/IVX/XLC/;
185 $r = $t . $r;
186 }
187 if($n =~ s/(\d)$//) {
188 (my $t = $roman[$1]) =~ tr/IVX/CDM/;
189 $r = $t . $r;
190 }
191 if($n =~ s/(\d)$//) {
192 (my $t = $roman[$1]) =~ tr/IVX/M../;
193 $r = $t . $r;
194 }
195 $r;
196}
197
198sub format_a { $DoWs[$_[0]->[6]] }
199sub format_A { $DoW[$_[0]->[6]] }
200sub format_b { $MoYs[$_[0]->[4]] }
201sub format_B { $MoY[$_[0]->[4]] }
202sub format_h { $MoYs[$_[0]->[4]] }
203sub format_p { $_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0] }
204sub format_P { lc($_[0]->[2] >= 12 ? $AMPM[1] : $AMPM[0]) }
205
206sub format_d { sprintf("%02d",$_[0]->[3]) }
207sub format_e { sprintf("%2d",$_[0]->[3]) }
208sub format_H { sprintf("%02d",$_[0]->[2]) }
209sub format_I { sprintf("%02d",$_[0]->[2] % 12 || 12)}
210sub format_j { sprintf("%03d",$_[0]->[7] + 1) }
211sub format_k { sprintf("%2d",$_[0]->[2]) }
212sub format_l { sprintf("%2d",$_[0]->[2] % 12 || 12)}
213sub format_L { $_[0]->[4] + 1 }
214sub format_m { sprintf("%02d",$_[0]->[4] + 1) }
215sub format_M { sprintf("%02d",$_[0]->[1]) }
216sub format_q { sprintf("%01d",int($_[0]->[4] / 3) + 1) }
217sub format_s {
218 $epoch = timelocal(@{$_[0]}[0..5])
219 unless defined $epoch;
220 sprintf("%d",$epoch)
221}
222sub format_S { sprintf("%02d",$_[0]->[0]) }
223sub format_U { wkyr(0, $_[0]->[6], $_[0]->[7]) }
224sub format_w { $_[0]->[6] }
225sub format_W { wkyr(1, $_[0]->[6], $_[0]->[7]) }
226sub format_y { sprintf("%02d",$_[0]->[5] % 100) }
227sub format_Y { sprintf("%04d",$_[0]->[5] + 1900) }
228
229sub format_Z {
230 my $o = tz_local_offset(timelocal(@{$_[0]}[0..5]));
231 defined $tzname ? $tzname : uc tz_name($o, $_[0]->[8]);
232}
233
234sub format_z {
235 my $t = timelocal(@{$_[0]}[0..5]);
236 my $o = defined $tzname ? tz_offset($tzname, $t) : tz_offset(undef,$t);
237 sprintf("%+03d%02d", int($o / 3600), int(abs($o) % 3600) / 60);
238}
239
240sub format_c { &format_x . " " . &format_X }
241sub format_D { &format_m . "/" . &format_d . "/" . &format_y }
242sub format_r { &format_I . ":" . &format_M . ":" . &format_S . " " . &format_p }
243sub format_R { &format_H . ":" . &format_M }
244sub format_T { &format_H . ":" . &format_M . ":" . &format_S }
245sub format_t { "\t" }
246sub format_n { "\n" }
247sub format_o { sprintf("%2d%s",$_[0]->[3],$Dsuf[$_[0]->[3]]) }
248sub format_x { my $f = $format{'x'}; _subs($_[0],$f); }
249sub format_X { my $f = $format{'X'}; _subs($_[0],$f); }
250sub format_C { my $f = $format{'C'}; _subs($_[0],$f); }
251
252sub format_Od { roman(format_d(@_)) }
253sub format_Oe { roman(format_e(@_)) }
254sub format_OH { roman(format_H(@_)) }
255sub format_OI { roman(format_I(@_)) }
256sub format_Oj { roman(format_j(@_)) }
257sub format_Ok { roman(format_k(@_)) }
258sub format_Ol { roman(format_l(@_)) }
259sub format_Om { roman(format_m(@_)) }
260sub format_OM { roman(format_M(@_)) }
261sub format_Oq { roman(format_q(@_)) }
262sub format_Oy { roman(format_y(@_)) }
263sub format_OY { roman(format_Y(@_)) }
264
265sub format_G { int(($_[0]->[9] - 315993600) / 604800) }
266
2671;
268__END__