Filename | /usr/lib/perl5/site_perl/5.12.4/i686-linux/DateTime/Infinite.pm |
Statements | Executed 47 statements in 4.31ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 94µs | 122µs | BEGIN@6 | DateTime::Infinite::
1 | 1 | 1 | 59µs | 439µs | BEGIN@44 | DateTime::Infinite::Future::
1 | 1 | 1 | 58µs | 408µs | BEGIN@12 | DateTime::Infinite::
1 | 1 | 1 | 56µs | 156µs | BEGIN@7 | DateTime::Infinite::
1 | 1 | 1 | 53µs | 416µs | BEGIN@68 | DateTime::Infinite::Past::
1 | 1 | 1 | 52µs | 138µs | BEGIN@15 | DateTime::Infinite::
2 | 1 | 1 | 42µs | 42µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 38µs | 38µs | BEGIN@9 | DateTime::Infinite::
1 | 1 | 1 | 35µs | 35µs | BEGIN@10 | DateTime::Infinite::
2 | 1 | 1 | 34µs | 34µs | _seconds_as_components | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | new | DateTime::Infinite::Future::
0 | 0 | 0 | 0s | 0s | new | DateTime::Infinite::Past::
0 | 0 | 0 | 0s | 0s | STORABLE_freeze | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | STORABLE_thaw | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | __ANON__[:16] | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | _stringify | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | is_finite | DateTime::Infinite::
0 | 0 | 0 | 0s | 0s | is_infinite | DateTime::Infinite::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::Infinite; | ||||
2 | { | ||||
3 | 2 | 11µs | $DateTime::Infinite::VERSION = '0.76'; | ||
4 | } | ||||
5 | |||||
6 | 3 | 180µs | 2 | 149µs | # spent 122µs (94+28) within DateTime::Infinite::BEGIN@6 which was called:
# once (94µs+28µs) by main::BEGIN@1 at line 6 # spent 122µs making 1 call to DateTime::Infinite::BEGIN@6
# spent 28µs making 1 call to strict::import |
7 | 3 | 139µs | 2 | 255µs | # spent 156µs (56+100) within DateTime::Infinite::BEGIN@7 which was called:
# once (56µs+100µs) by main::BEGIN@1 at line 7 # spent 156µs making 1 call to DateTime::Infinite::BEGIN@7
# spent 100µs making 1 call to warnings::import |
8 | |||||
9 | 3 | 130µs | 1 | 38µs | # spent 38µs within DateTime::Infinite::BEGIN@9 which was called:
# once (38µs+0s) by main::BEGIN@1 at line 9 # spent 38µs making 1 call to DateTime::Infinite::BEGIN@9 |
10 | 3 | 146µs | 1 | 35µs | # spent 35µs within DateTime::Infinite::BEGIN@10 which was called:
# once (35µs+0s) by main::BEGIN@1 at line 10 # spent 35µs making 1 call to DateTime::Infinite::BEGIN@10 |
11 | |||||
12 | 3 | 210µs | 2 | 758µs | # spent 408µs (58+350) within DateTime::Infinite::BEGIN@12 which was called:
# once (58µs+350µs) by main::BEGIN@1 at line 12 # spent 408µs making 1 call to DateTime::Infinite::BEGIN@12
# spent 350µs making 1 call to base::import |
13 | |||||
14 | 1 | 9µs | foreach my $m (qw( set set_time_zone truncate )) { | ||
15 | 3 | 1.15ms | 2 | 223µs | # spent 138µs (52+85) within DateTime::Infinite::BEGIN@15 which was called:
# once (52µs+85µs) by main::BEGIN@1 at line 15 # spent 138µs making 1 call to DateTime::Infinite::BEGIN@15
# spent 85µs making 1 call to strict::unimport |
16 | 3 | 108µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
17 | } | ||||
18 | |||||
19 | sub is_finite {0} | ||||
20 | sub is_infinite {1} | ||||
21 | |||||
22 | # spent 42µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 21µs/call:
# 2 times (42µs+0s) by DateTime::_calc_local_components at line 435 of DateTime.pm, avg 21µs/call | ||||
23 | 2 | 58µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
24 | } | ||||
25 | |||||
26 | # spent 34µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 17µs/call:
# 2 times (34µs+0s) by DateTime::_calc_local_components at line 440 of DateTime.pm, avg 17µs/call | ||||
27 | 2 | 47µs | return ( $_[1] ) x 3; | ||
28 | } | ||||
29 | |||||
30 | sub _stringify { | ||||
31 | $_[0]->{utc_rd_days} == DateTime::INFINITY | ||||
32 | ? DateTime::INFINITY . '' | ||||
33 | : DateTime::NEG_INFINITY . ''; | ||||
34 | } | ||||
35 | |||||
36 | sub STORABLE_freeze {return} | ||||
37 | sub STORABLE_thaw {return} | ||||
38 | |||||
39 | package DateTime::Infinite::Future; | ||||
40 | { | ||||
41 | 2 | 10µs | $DateTime::Infinite::Future::VERSION = '0.76'; | ||
42 | } | ||||
43 | |||||
44 | 3 | 600µs | 2 | 820µs | # spent 439µs (59+381) within DateTime::Infinite::Future::BEGIN@44 which was called:
# once (59µs+381µs) by main::BEGIN@1 at line 44 # spent 439µs making 1 call to DateTime::Infinite::Future::BEGIN@44
# spent 380µs making 1 call to base::import |
45 | |||||
46 | { | ||||
47 | 4 | 421µs | 1 | 391µs | my $Pos = bless { # spent 391µs making 1 call to DateTime::TimeZone::new |
48 | utc_rd_days => DateTime::INFINITY, | ||||
49 | utc_rd_secs => DateTime::INFINITY, | ||||
50 | local_rd_days => DateTime::INFINITY, | ||||
51 | local_rd_secs => DateTime::INFINITY, | ||||
52 | rd_nanosecs => DateTime::INFINITY, | ||||
53 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
54 | }, | ||||
55 | __PACKAGE__; | ||||
56 | |||||
57 | 1 | 176µs | $Pos->_calc_utc_rd; # spent 176µs making 1 call to DateTime::_calc_utc_rd | ||
58 | 1 | 309µs | $Pos->_calc_local_rd; # spent 309µs making 1 call to DateTime::_calc_local_rd | ||
59 | |||||
60 | sub new {$Pos} | ||||
61 | } | ||||
62 | |||||
63 | package DateTime::Infinite::Past; | ||||
64 | { | ||||
65 | 2 | 11µs | $DateTime::Infinite::Past::VERSION = '0.76'; | ||
66 | } | ||||
67 | |||||
68 | 3 | 619µs | 2 | 779µs | # spent 416µs (53+363) within DateTime::Infinite::Past::BEGIN@68 which was called:
# once (53µs+363µs) by main::BEGIN@1 at line 68 # spent 416µs making 1 call to DateTime::Infinite::Past::BEGIN@68
# spent 363µs making 1 call to base::import |
69 | |||||
70 | { | ||||
71 | 4 | 391µs | 1 | 329µs | my $Neg = bless { # spent 329µs making 1 call to DateTime::TimeZone::new |
72 | utc_rd_days => DateTime::NEG_INFINITY, | ||||
73 | utc_rd_secs => DateTime::NEG_INFINITY, | ||||
74 | local_rd_days => DateTime::NEG_INFINITY, | ||||
75 | local_rd_secs => DateTime::NEG_INFINITY, | ||||
76 | rd_nanosecs => DateTime::NEG_INFINITY, | ||||
77 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
78 | }, | ||||
79 | __PACKAGE__; | ||||
80 | |||||
81 | 1 | 128µs | $Neg->_calc_utc_rd; # spent 128µs making 1 call to DateTime::_calc_utc_rd | ||
82 | 1 | 283µs | $Neg->_calc_local_rd; # spent 283µs making 1 call to DateTime::_calc_local_rd | ||
83 | |||||
84 | sub new {$Neg} | ||||
85 | } | ||||
86 | |||||
87 | 1 | 68µs | 1; | ||
88 | |||||
89 | # ABSTRACT: Infinite past and future DateTime objects | ||||
90 | |||||
- - | |||||
93 | =pod | ||||
94 | |||||
95 | =head1 NAME | ||||
96 | |||||
97 | DateTime::Infinite - Infinite past and future DateTime objects | ||||
98 | |||||
99 | =head1 VERSION | ||||
100 | |||||
101 | version 0.76 | ||||
102 | |||||
103 | =head1 SYNOPSIS | ||||
104 | |||||
105 | my $future = DateTime::Infinite::Future->new(); | ||||
106 | my $past = DateTime::Infinite::Past->new(); | ||||
107 | |||||
108 | =head1 DESCRIPTION | ||||
109 | |||||
110 | This module provides two L<DateTime.pm|DateTime> subclasses, | ||||
111 | C<DateTime::Infinite::Future> and C<DateTime::Infinite::Past>. | ||||
112 | |||||
113 | The objects are in the "floating" timezone, and this cannot be | ||||
114 | changed. | ||||
115 | |||||
116 | =head1 BUGS | ||||
117 | |||||
118 | There seem to be lots of problems when dealing with infinite numbers | ||||
119 | on Win32. This may be a problem with this code, Perl, or Win32's IEEE | ||||
120 | math implementation. Either way, the module may not be well-behaved | ||||
121 | on Win32 operating systems. | ||||
122 | |||||
123 | =head1 METHODS | ||||
124 | |||||
125 | The only constructor for these two classes is the C<new()> method, as | ||||
126 | shown in the L<SYNOPSIS|/SYNOPSIS>. This method takes no parameters. | ||||
127 | |||||
128 | All "get" methods in this module simply return infinity, positive or | ||||
129 | negative. If the method is expected to return a string, it return the | ||||
130 | string representation of positive or negative infinity used by your | ||||
131 | system. For example, on my system calling C<year()> returns a number | ||||
132 | which when printed appears either "inf" or "-inf". | ||||
133 | |||||
134 | The object is not mutable, so the C<set()>, C<set_time_zone()>, and | ||||
135 | C<truncate()> methods are all do-nothing methods that simply return | ||||
136 | the object they are called with. | ||||
137 | |||||
138 | Obviously, the C<is_finite()> method returns false and the | ||||
139 | C<is_infinite()> method returns true. | ||||
140 | |||||
141 | =head1 SEE ALSO | ||||
142 | |||||
143 | datetime@perl.org mailing list | ||||
144 | |||||
145 | http://datetime.perl.org/ | ||||
146 | |||||
147 | =head1 AUTHOR | ||||
148 | |||||
149 | Dave Rolsky <autarch@urth.org> | ||||
150 | |||||
151 | =head1 COPYRIGHT AND LICENSE | ||||
152 | |||||
153 | This software is Copyright (c) 2012 by Dave Rolsky. | ||||
154 | |||||
155 | This is free software, licensed under: | ||||
156 | |||||
157 | The Artistic License 2.0 (GPL Compatible) | ||||
158 | |||||
159 | =cut | ||||
160 | |||||
161 | |||||
162 | __END__ |