| Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux/DateTime/Infinite.pm |
| Statements | Executed 47 statements in 722µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 21µs | 27µs | DateTime::Infinite::BEGIN@6 |
| 1 | 1 | 1 | 10µs | 29µs | DateTime::Infinite::BEGIN@7 |
| 1 | 1 | 1 | 8µs | 92µs | DateTime::Infinite::BEGIN@12 |
| 1 | 1 | 1 | 8µs | 58µs | DateTime::Infinite::Past::BEGIN@68 |
| 1 | 1 | 1 | 8µs | 58µs | DateTime::Infinite::Future::BEGIN@44 |
| 1 | 1 | 1 | 7µs | 22µs | DateTime::Infinite::BEGIN@15 |
| 1 | 1 | 1 | 6µs | 6µs | DateTime::Infinite::BEGIN@10 |
| 2 | 1 | 1 | 6µs | 6µs | DateTime::Infinite::_rd2ymd |
| 1 | 1 | 1 | 5µs | 5µs | DateTime::Infinite::BEGIN@9 |
| 2 | 1 | 1 | 3µs | 3µs | DateTime::Infinite::_seconds_as_components |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::Future::new |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::Past::new |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::STORABLE_freeze |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::STORABLE_thaw |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::__ANON__[:16] |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::_stringify |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::is_finite |
| 0 | 0 | 0 | 0s | 0s | DateTime::Infinite::is_infinite |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package DateTime::Infinite; | ||||
| 2 | { | ||||
| 3 | 2 | 1µs | $DateTime::Infinite::VERSION = '0.74'; | ||
| 4 | } | ||||
| 5 | |||||
| 6 | 3 | 25µs | 2 | 33µs | # spent 27µs (21+6) within DateTime::Infinite::BEGIN@6 which was called:
# once (21µs+6µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 6 # spent 27µs making 1 call to DateTime::Infinite::BEGIN@6
# spent 6µs making 1 call to strict::import |
| 7 | 3 | 20µs | 2 | 48µs | # spent 29µs (10+19) within DateTime::Infinite::BEGIN@7 which was called:
# once (10µs+19µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 7 # spent 29µs making 1 call to DateTime::Infinite::BEGIN@7
# spent 19µs making 1 call to warnings::import |
| 8 | |||||
| 9 | 3 | 18µs | 1 | 5µs | # spent 5µs within DateTime::Infinite::BEGIN@9 which was called:
# once (5µs+0s) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 9 # spent 5µs making 1 call to DateTime::Infinite::BEGIN@9 |
| 10 | 3 | 23µs | 1 | 6µs | # spent 6µs within DateTime::Infinite::BEGIN@10 which was called:
# once (6µs+0s) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 10 # spent 6µs making 1 call to DateTime::Infinite::BEGIN@10 |
| 11 | |||||
| 12 | 3 | 32µs | 2 | 175µs | # spent 92µs (8+83) within DateTime::Infinite::BEGIN@12 which was called:
# once (8µs+83µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 12 # spent 92µs making 1 call to DateTime::Infinite::BEGIN@12
# spent 83µs making 1 call to base::import |
| 13 | |||||
| 14 | 1 | 900ns | foreach my $m (qw( set set_time_zone truncate )) { | ||
| 15 | 3 | 193µs | 2 | 37µs | # spent 22µs (7+15) within DateTime::Infinite::BEGIN@15 which was called:
# once (7µs+15µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 15 # spent 22µs making 1 call to DateTime::Infinite::BEGIN@15
# spent 15µs making 1 call to strict::unimport |
| 16 | 3 | 18µs | *{"DateTime::Infinite::$m"} = sub { return $_[0] }; | ||
| 17 | } | ||||
| 18 | |||||
| 19 | sub is_finite {0} | ||||
| 20 | sub is_infinite {1} | ||||
| 21 | |||||
| 22 | # spent 6µs within DateTime::Infinite::_rd2ymd which was called 2 times, avg 3µs/call:
# 2 times (6µs+0s) by DateTime::_calc_local_components at line 437 of DateTime.pm, avg 3µs/call | ||||
| 23 | 2 | 9µs | return $_[2] ? ( $_[1] ) x 7 : ( $_[1] ) x 3; | ||
| 24 | } | ||||
| 25 | |||||
| 26 | # spent 3µs within DateTime::Infinite::_seconds_as_components which was called 2 times, avg 2µs/call:
# 2 times (3µs+0s) by DateTime::_calc_local_components at line 442 of DateTime.pm, avg 2µs/call | ||||
| 27 | 2 | 6µ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 | 600ns | $DateTime::Infinite::Future::VERSION = '0.74'; | ||
| 42 | } | ||||
| 43 | |||||
| 44 | 3 | 96µs | 2 | 107µs | # spent 58µs (8+50) within DateTime::Infinite::Future::BEGIN@44 which was called:
# once (8µs+50µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 44 # spent 58µs making 1 call to DateTime::Infinite::Future::BEGIN@44
# spent 50µs making 1 call to base::import |
| 45 | |||||
| 46 | { | ||||
| 47 | 2 | 87µs | 1 | 111µs | my $Pos = bless { # spent 111µ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 | 4µs | 1 | 34µs | $Pos->_calc_utc_rd; # spent 34µs making 1 call to DateTime::_calc_utc_rd |
| 58 | 1 | 6µs | 1 | 52µs | $Pos->_calc_local_rd; # spent 52µs making 1 call to DateTime::_calc_local_rd |
| 59 | |||||
| 60 | sub new {$Pos} | ||||
| 61 | } | ||||
| 62 | |||||
| 63 | package DateTime::Infinite::Past; | ||||
| 64 | { | ||||
| 65 | 2 | 700ns | $DateTime::Infinite::Past::VERSION = '0.74'; | ||
| 66 | } | ||||
| 67 | |||||
| 68 | 3 | 92µs | 2 | 108µs | # spent 58µs (8+50) within DateTime::Infinite::Past::BEGIN@68 which was called:
# once (8µs+50µs) by Tapper::Schema::TestrunDB::ResultSet::Testrun::BEGIN@12 at line 68 # spent 58µs making 1 call to DateTime::Infinite::Past::BEGIN@68
# spent 50µs making 1 call to base::import |
| 69 | |||||
| 70 | { | ||||
| 71 | 2 | 73µs | 1 | 40µs | my $Neg = bless { # spent 40µ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 | 3µs | 1 | 13µs | $Neg->_calc_utc_rd; # spent 13µs making 1 call to DateTime::_calc_utc_rd |
| 82 | 1 | 4µs | 1 | 28µs | $Neg->_calc_local_rd; # spent 28µs making 1 call to DateTime::_calc_local_rd |
| 83 | |||||
| 84 | sub new {$Neg} | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | 1 | 12µ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.74 | ||||
| 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__ |