| Filename | /usr/share/perl5/DateTime/Format/MySQL.pm |
| Statements | Executed 14 statements in 927µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 4.60ms | 14.9ms | DateTime::Format::MySQL::BEGIN@11 |
| 10 | 1 | 1 | 74µs | 74µs | DateTime::Format::MySQL::CORE:qr (opcode) |
| 1 | 1 | 1 | 17µs | 21µs | DateTime::Format::MySQL::BEGIN@3 |
| 1 | 1 | 1 | 15µs | 48µs | DateTime::Format::MySQL::BEGIN@5 |
| 1 | 1 | 1 | 12µs | 14µs | DateTime::Format::MySQL::BEGIN@9 |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::MySQL::_fix_2_digit_year |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::MySQL::format_date |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::MySQL::format_datetime |
| 0 | 0 | 0 | 0s | 0s | DateTime::Format::MySQL::format_time |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package DateTime::Format::MySQL; | ||||
| 2 | |||||
| 3 | 3 | 42µs | 2 | 25µs | # spent 21µs (17+4) within DateTime::Format::MySQL::BEGIN@3 which was called:
# once (17µs+4µs) by C4::Koha::BEGIN@30 at line 3 # spent 21µs making 1 call to DateTime::Format::MySQL::BEGIN@3
# spent 4µs making 1 call to strict::import |
| 4 | |||||
| 5 | 3 | 42µs | 2 | 80µs | # spent 48µs (15+33) within DateTime::Format::MySQL::BEGIN@5 which was called:
# once (15µs+33µs) by C4::Koha::BEGIN@30 at line 5 # spent 48µs making 1 call to DateTime::Format::MySQL::BEGIN@5
# spent 33µs making 1 call to vars::import |
| 6 | |||||
| 7 | 1 | 1µs | $VERSION = '0.04'; | ||
| 8 | |||||
| 9 | 3 | 310µs | 2 | 16µs | # spent 14µs (12+2) within DateTime::Format::MySQL::BEGIN@9 which was called:
# once (12µs+2µs) by C4::Koha::BEGIN@30 at line 9 # spent 14µs making 1 call to DateTime::Format::MySQL::BEGIN@9
# spent 2µs making 1 call to UNIVERSAL::import |
| 10 | use DateTime::Format::Builder | ||||
| 11 | 1 | 187µs | 11 | 4.06ms | # spent 14.9ms (4.60+10.3) within DateTime::Format::MySQL::BEGIN@11 which was called:
# once (4.60ms+10.3ms) by C4::Koha::BEGIN@30 at line 71 # spent 3.99ms making 1 call to DateTime::Format::Builder::import
# spent 74µs making 10 calls to DateTime::Format::MySQL::CORE:qr, avg 7µs/call |
| 12 | { parse_date => | ||||
| 13 | { params => [ qw( year month day ) ], | ||||
| 14 | regex => qr/^(\d{1,4})-(\d\d)-(\d\d)$/, | ||||
| 15 | }, | ||||
| 16 | |||||
| 17 | parse_datetime => | ||||
| 18 | { params => [ qw( year month day hour minute second ) ], | ||||
| 19 | regex => qr/^(\d{1,4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/, | ||||
| 20 | extra => { time_zone => 'floating' }, | ||||
| 21 | }, | ||||
| 22 | |||||
| 23 | parse_timestamp => | ||||
| 24 | [ { length => 14, | ||||
| 25 | params => [ qw( year month day hour minute second ) ], | ||||
| 26 | regex => qr/^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, | ||||
| 27 | extra => { time_zone => 'floating' }, | ||||
| 28 | }, | ||||
| 29 | { | ||||
| 30 | params => [ qw( year month day hour minute second ) ], | ||||
| 31 | regex => qr/^(\d{1,4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)$/, | ||||
| 32 | extra => { time_zone => 'floating'}, | ||||
| 33 | }, | ||||
| 34 | { length => 12, | ||||
| 35 | params => [ qw( year month day hour minute second ) ], | ||||
| 36 | regex => qr/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, | ||||
| 37 | extra => { time_zone => 'floating' }, | ||||
| 38 | postprocess => \&_fix_2_digit_year, | ||||
| 39 | }, | ||||
| 40 | { length => 10, | ||||
| 41 | params => [ qw( year month day hour minute ) ], | ||||
| 42 | regex => qr/^(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/, | ||||
| 43 | extra => { time_zone => 'floating' }, | ||||
| 44 | postprocess => \&_fix_2_digit_year, | ||||
| 45 | }, | ||||
| 46 | { length => 8, | ||||
| 47 | params => [ qw( year month day ) ], | ||||
| 48 | regex => qr/^(\d\d\d\d)(\d\d)(\d\d)$/, | ||||
| 49 | extra => { time_zone => 'floating' }, | ||||
| 50 | }, | ||||
| 51 | { length => 6, | ||||
| 52 | params => [ qw( year month day ) ], | ||||
| 53 | regex => qr/^(\d\d)(\d\d)(\d\d)$/, | ||||
| 54 | extra => { time_zone => 'floating' }, | ||||
| 55 | postprocess => \&_fix_2_digit_year, | ||||
| 56 | }, | ||||
| 57 | { length => 4, | ||||
| 58 | params => [ qw( year month ) ], | ||||
| 59 | regex => qr/^(\d\d)(\d\d)$/, | ||||
| 60 | extra => { time_zone => 'floating' }, | ||||
| 61 | postprocess => \&_fix_2_digit_year, | ||||
| 62 | }, | ||||
| 63 | { length => 2, | ||||
| 64 | params => [ qw( year ) ], | ||||
| 65 | regex => qr/^(\d\d)$/, | ||||
| 66 | extra => { time_zone => 'floating' }, | ||||
| 67 | postprocess => \&_fix_2_digit_year, | ||||
| 68 | }, | ||||
| 69 | ], | ||||
| 70 | }, | ||||
| 71 | 2 | 342µs | 1 | 14.9ms | ); # spent 14.9ms making 1 call to DateTime::Format::MySQL::BEGIN@11 |
| 72 | |||||
| 73 | sub _fix_2_digit_year | ||||
| 74 | { | ||||
| 75 | my %p = @_; | ||||
| 76 | |||||
| 77 | $p{parsed}{year} += $p{parsed}{year} <= 69 ? 2000 : 1900; | ||||
| 78 | } | ||||
| 79 | |||||
| 80 | sub format_date | ||||
| 81 | { | ||||
| 82 | my ( $self, $dt ) = @_; | ||||
| 83 | |||||
| 84 | return $dt->ymd('-'); | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | sub format_time | ||||
| 88 | { | ||||
| 89 | my ( $self, $dt ) = @_; | ||||
| 90 | |||||
| 91 | return $dt->hms(':'); | ||||
| 92 | } | ||||
| 93 | |||||
| 94 | sub format_datetime | ||||
| 95 | { | ||||
| 96 | my ( $self, $dt ) = @_; | ||||
| 97 | |||||
| 98 | return $self->format_date($dt) . ' ' . $self->format_time($dt); | ||||
| 99 | } | ||||
| 100 | |||||
| 101 | |||||
| 102 | 1 | 4µs | 1; | ||
| 103 | |||||
| 104 | __END__ | ||||
# spent 74µs within DateTime::Format::MySQL::CORE:qr which was called 10 times, avg 7µs/call:
# 10 times (74µs+0s) by DateTime::Format::MySQL::BEGIN@11 at line 11, avg 7µs/call |