| 1 | 2 | ▶ | use v5.10.1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Neo4j::Types::Generic::DateTime; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Generic representation of a Neo4j temporal instant value | ||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | $Neo4j::Types::Generic::DateTime::VERSION = '2.00'; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use parent 'Neo4j::Types::DateTime'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 18 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | # uncoverable pod - see Generic.pod | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 18 | my ($class, $dt, $tz) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 18 | ▶ | if (ref $dt eq '') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | my $days = int $dt / 86400; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | $dt = { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | days => $dt < 0 ? $days - 1 : $days, # floor | ||||||||||||||||||||||||||||||||||||||||||
| 20 | seconds => $dt % 86400, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | if ($tz && 0x40 & ord substr $tz, 0, 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$tz and 64 & ord substr($tz, 0, 1)
MC/DC100%2/2
$tz and 64 & ord substr($tz, 0, 1)
$tz
64 & ord substr($tz, 0, 1)
Truth table100%3/3
A and B
A= $tzB= 64 & ord substr($tz, 0, 1)
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | $dt->{tz_name} = $tz; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 4 | $dt->{tz_offset} = $tz; | |||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 18 | ▶ | if (defined $dt->{seconds} && ! defined $dt->{nanoseconds}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $dt->{"seconds"} and not defined $dt->{"nanoseconds"}
MC/DC100%2/2
defined $dt->{"seconds"} and not defined $dt->{"nanoseconds"}
defined $dt->{"seconds"}
not defined $dt->{"nanoseconds"}
Truth table100%3/3
A and not(B)
A= defined $dt->{"seconds"}B= not defined $dt->{"nanoseconds"}
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 8 | $dt->{nanoseconds} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | 18 | ▶ | if (! defined $dt->{seconds} && defined $dt->{nanoseconds}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not defined $dt->{"seconds"} and defined $dt->{"nanoseconds"}
MC/DC100%2/2
not defined $dt->{"seconds"} and defined $dt->{"nanoseconds"}
not defined $dt->{"seconds"}
defined $dt->{"nanoseconds"}
Truth table100%3/3
not(A) and B
A= not defined $dt->{"seconds"}B= defined $dt->{"nanoseconds"}
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | $dt->{seconds} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 18 | return bless $dt, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 52 | ▶ | sub days { shift->{days} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
days: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 54 | ▶ | sub seconds { shift->{seconds} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seconds: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 18 | ▶ | sub nanoseconds { shift->{nanoseconds} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
nanoseconds: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 34 | ▶ | sub tz_offset { shift->{tz_offset} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tz_offset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 22 | ▶ | sub tz_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tz_name: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 22 | ▶ | if ( ! exists $self->{tz_name} && defined $self->{tz_offset} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not exists $self->{"tz_name"} and defined $self->{"tz_offset"}
MC/DC100%2/2
not exists $self->{"tz_name"} and defined $self->{"tz_offset"}
not exists $self->{"tz_name"}
defined $self->{"tz_offset"}
Truth table100%3/3
not(A) and B
A= not exists $self->{"tz_name"}B= defined $self->{"tz_offset"}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 10 | ▶ | if ( $self->{tz_offset} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 2 | return $self->{tz_name} = 'Etc/GMT'; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | 8 | my $hours = $self->{tz_offset} / -3600; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 8 | ▶ | if ( $hours != int $hours || $hours > 12 || $hours < -14 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$hours != int $hours or $hours > 12 or $hours < -14
$hours != int $hours or $hours > 12
MC/DC100%3/3
$hours != int $hours or $hours > 12 or $hours < -14
$hours != int $hours
$hours > 12
$hours < -14
Truth table100%4/4
A or B or C
A= $hours != int $hoursB= $hours > 12C= $hours < -14
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 6 | return $self->{tz_name} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 2 | $self->{tz_name} = sprintf 'Etc/GMT%+i', $hours; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 14 | return $self->{tz_name}; | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||