File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/DateTime/Infinite.pm |
Statements Executed | 42 |
Statement Execution Time | 629µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 18µs | 22µs | BEGIN@3 | DateTime::Infinite::
1 | 1 | 1 | 13µs | 63µs | BEGIN@11 | DateTime::Infinite::
1 | 1 | 1 | 8µs | 24µs | BEGIN@4 | DateTime::Infinite::
1 | 1 | 1 | 8µs | 46µs | BEGIN@42 | DateTime::Infinite::Future::
1 | 1 | 1 | 7µs | 24µs | BEGIN@14 | DateTime::Infinite::
1 | 1 | 1 | 7µs | 43µs | BEGIN@63 | DateTime::Infinite::Past::
2 | 1 | 1 | 5µs | 5µs | _rd2ymd | DateTime::Infinite::
1 | 1 | 1 | 4µs | 4µs | BEGIN@8 | DateTime::Infinite::
1 | 1 | 1 | 3µs | 3µs | BEGIN@9 | DateTime::Infinite::
2 | 1 | 1 | 3µs | 3µ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__[:15] | 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 | 3 | 22µs | 2 | 26µs | # spent 22µs (18+4) within DateTime::Infinite::BEGIN@3 which was called
# once (18µs+4µs) by SimpleDB::Class::SQL::BEGIN@19 at line 3 # spent 22µs making 1 call to DateTime::Infinite::BEGIN@3
# spent 4µs making 1 call to strict::import |
4 | 3 | 29µs | 2 | 40µs | # spent 24µs (8+16) within DateTime::Infinite::BEGIN@4 which was called
# once (8µs+16µs) by SimpleDB::Class::SQL::BEGIN@19 at line 4 # spent 24µs making 1 call to DateTime::Infinite::BEGIN@4
# spent 16µs making 1 call to warnings::import |
5 | |||||
6 | 1 | 300ns | our $VERSION = '0.55'; | ||
7 | |||||
8 | 3 | 18µs | 1 | 4µs | # spent 4µs within DateTime::Infinite::BEGIN@8 which was called
# once (4µs+0s) by SimpleDB::Class::SQL::BEGIN@19 at line 8 # spent 4µs making 1 call to DateTime::Infinite::BEGIN@8 |
9 | 3 | 20µs | 1 | 3µs | # spent 3µs within DateTime::Infinite::BEGIN@9 which was called
# once (3µs+0s) by SimpleDB::Class::SQL::BEGIN@19 at line 9 # spent 3µs making 1 call to DateTime::Infinite::BEGIN@9 |
10 | |||||
11 | 3 | 30µs | 2 | 112µs | # spent 63µs (13+50) within DateTime::Infinite::BEGIN@11 which was called
# once (13µs+50µs) by SimpleDB::Class::SQL::BEGIN@19 at line 11 # spent 63µs making 1 call to DateTime::Infinite::BEGIN@11
# spent 50µs making 1 call to base::import |
12 | |||||
13 | 1 | 800ns | foreach my $m (qw( set set_time_zone truncate )) { | ||
14 | 3 | 157µs | 2 | 41µs | # spent 24µs (7+17) within DateTime::Infinite::BEGIN@14 which was called
# once (7µs+17µs) by SimpleDB::Class::SQL::BEGIN@19 at line 14 # spent 24µs making 1 call to DateTime::Infinite::BEGIN@14
# spent 17µs making 1 call to strict::unimport |
15 | 3 | 15µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
16 | } | ||||
17 | |||||
18 | sub is_finite {0} | ||||
19 | sub is_infinite {1} | ||||
20 | |||||
21 | # spent 5µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 3µs/call:
# 2 times (5µs+0s) by DateTime::_calc_local_components at line 403 of DateTime.pm, avg 3µs/call | ||||
22 | 2 | 8µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
23 | } | ||||
24 | |||||
25 | # spent 3µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 1µs/call:
# 2 times (3µs+0s) by DateTime::_calc_local_components at line 408 of DateTime.pm, avg 1µs/call | ||||
26 | 2 | 5µs | return ( $_[1] ) x 3; | ||
27 | } | ||||
28 | |||||
29 | sub _stringify { | ||||
30 | ( | ||||
31 | $_[0]->{utc_rd_days} == DateTime::INFINITY | ||||
32 | ? DateTime::INFINITY . '' | ||||
33 | : DateTime::NEG_INFINITY . '' | ||||
34 | ); | ||||
35 | } | ||||
36 | |||||
37 | sub STORABLE_freeze {return} | ||||
38 | sub STORABLE_thaw {return} | ||||
39 | |||||
40 | package DateTime::Infinite::Future; | ||||
41 | |||||
42 | 3 | 76µs | 2 | 85µs | # spent 46µs (8+39) within DateTime::Infinite::Future::BEGIN@42 which was called
# once (8µs+39µs) by SimpleDB::Class::SQL::BEGIN@19 at line 42 # spent 46µs making 1 call to DateTime::Infinite::Future::BEGIN@42
# spent 38µs making 1 call to base::import |
43 | |||||
44 | { | ||||
45 | 2 | 71µs | 1 | 77µs | my $Pos = bless { # spent 77µs making 1 call to DateTime::TimeZone::new |
46 | utc_rd_days => DateTime::INFINITY, | ||||
47 | utc_rd_secs => DateTime::INFINITY, | ||||
48 | local_rd_days => DateTime::INFINITY, | ||||
49 | local_rd_secs => DateTime::INFINITY, | ||||
50 | rd_nanosecs => DateTime::INFINITY, | ||||
51 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
52 | }, | ||||
53 | __PACKAGE__; | ||||
54 | |||||
55 | 1 | 3µs | 1 | 32µs | $Pos->_calc_utc_rd; # spent 32µs making 1 call to DateTime::_calc_utc_rd |
56 | 1 | 4µs | 1 | 41µs | $Pos->_calc_local_rd; # spent 41µs making 1 call to DateTime::_calc_local_rd |
57 | |||||
58 | sub new {$Pos} | ||||
59 | } | ||||
60 | |||||
61 | package DateTime::Infinite::Past; | ||||
62 | |||||
63 | 3 | 78µs | 2 | 80µs | # spent 43µs (7+37) within DateTime::Infinite::Past::BEGIN@63 which was called
# once (7µs+37µs) by SimpleDB::Class::SQL::BEGIN@19 at line 63 # spent 43µs making 1 call to DateTime::Infinite::Past::BEGIN@63
# spent 37µs making 1 call to base::import |
64 | |||||
65 | { | ||||
66 | 2 | 59µs | 1 | 51µs | my $Neg = bless { # spent 51µs making 1 call to DateTime::TimeZone::new |
67 | utc_rd_days => DateTime::NEG_INFINITY, | ||||
68 | utc_rd_secs => DateTime::NEG_INFINITY, | ||||
69 | local_rd_days => DateTime::NEG_INFINITY, | ||||
70 | local_rd_secs => DateTime::NEG_INFINITY, | ||||
71 | rd_nanosecs => DateTime::NEG_INFINITY, | ||||
72 | tz => DateTime::TimeZone->new( name => 'floating' ), | ||||
73 | }, | ||||
74 | __PACKAGE__; | ||||
75 | |||||
76 | 1 | 2µs | 1 | 13µs | $Neg->_calc_utc_rd; # spent 13µs making 1 call to DateTime::_calc_utc_rd |
77 | 1 | 8µs | 1 | 30µs | $Neg->_calc_local_rd; # spent 30µs making 1 call to DateTime::_calc_local_rd |
78 | |||||
79 | sub new {$Neg} | ||||
80 | } | ||||
81 | |||||
82 | 1 | 22µs | 1; | ||
83 | |||||
84 | __END__ | ||||
85 | |||||
86 | =head1 NAME | ||||
87 | |||||
88 | DateTime::Infinite - Infinite past and future DateTime objects | ||||
89 | |||||
90 | =head1 SYNOPSIS | ||||
91 | |||||
92 | my $future = DateTime::Infinite::Future->new; | ||||
93 | my $past = DateTime::Infinite::Past->new; | ||||
94 | |||||
95 | =head1 DESCRIPTION | ||||
96 | |||||
97 | This module provides two L<DateTime.pm|DateTime> subclasses, | ||||
98 | C<DateTime::Infinite::Future> and C<DateTime::Infinite::Past>. | ||||
99 | |||||
100 | The objects are in the "floating" timezone, and this cannot be | ||||
101 | changed. | ||||
102 | |||||
103 | =head1 BUGS | ||||
104 | |||||
105 | There seem to be lots of problems when dealing with infinite numbers | ||||
106 | on Win32. This may be a problem with this code, Perl, or Win32's IEEE | ||||
107 | math implementation. Either way, the module may not be well-behaved | ||||
108 | on Win32 operating systems. | ||||
109 | |||||
110 | =head1 METHODS | ||||
111 | |||||
112 | The only constructor for these two classes is the C<new()> method, as | ||||
113 | shown in the L<SYNOPSIS|/SYNOPSIS>. This method takes no parameters. | ||||
114 | |||||
115 | All "get" methods in this module simply return infinity, positive or | ||||
116 | negative. If the method is expected to return a string, it return the | ||||
117 | string representation of positive or negative infinity used by your | ||||
118 | system. For example, on my system calling C<year()> returns a number | ||||
119 | which when printed appears either "inf" or "-inf". | ||||
120 | |||||
121 | The object is not mutable, so the C<set()>, C<set_time_zone()>, and | ||||
122 | C<truncate()> methods are all do-nothing methods that simply return | ||||
123 | the object they are called with. | ||||
124 | |||||
125 | Obviously, the C<is_finite()> method returns false and the | ||||
126 | C<is_infinite()> method returns true. | ||||
127 | |||||
128 | =head1 AUTHOR | ||||
129 | |||||
130 | Dave Rolsky <autarch@urth.org> | ||||
131 | |||||
132 | =head1 COPYRIGHT | ||||
133 | |||||
134 | Copyright (c) 2003-2010 David Rolsky. All rights reserved. This | ||||
135 | program is free software; you can redistribute it and/or modify it | ||||
136 | under the same terms as Perl itself. | ||||
137 | |||||
138 | The full text of the license can be found in the LICENSE file included | ||||
139 | with this module. | ||||
140 | |||||
141 | =head1 SEE ALSO | ||||
142 | |||||
143 | datetime@perl.org mailing list | ||||
144 | |||||
145 | http://datetime.perl.org/ | ||||
146 | |||||
147 | =cut | ||||
148 |