| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
716
|
use v5.10.1; |
|
|
2
|
|
|
|
|
6
|
|
|
2
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
76
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
139
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Neo4j::Types::Generic::DateTime; |
|
6
|
|
|
|
|
|
|
# ABSTRACT: Generic representation of a Neo4j temporal instant value |
|
7
|
|
|
|
|
|
|
$Neo4j::Types::Generic::DateTime::VERSION = '2.00'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
30
|
use parent 'Neo4j::Types::DateTime'; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
12
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
|
|
|
|
|
|
# uncoverable pod - see Generic.pod |
|
14
|
18
|
|
|
18
|
0
|
322
|
my ($class, $dt, $tz) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
18
|
100
|
|
|
|
92
|
if (ref $dt eq '') { |
|
17
|
5
|
|
|
|
|
22
|
my $days = int $dt / 86400; |
|
18
|
5
|
100
|
|
|
|
36
|
$dt = { |
|
19
|
|
|
|
|
|
|
days => $dt < 0 ? $days - 1 : $days, # floor |
|
20
|
|
|
|
|
|
|
seconds => $dt % 86400, |
|
21
|
|
|
|
|
|
|
}; |
|
22
|
5
|
100
|
100
|
|
|
46
|
if ($tz && 0x40 & ord substr $tz, 0, 1) { |
|
23
|
1
|
|
|
|
|
6
|
$dt->{tz_name} = $tz; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
else { |
|
26
|
4
|
|
|
|
|
15
|
$dt->{tz_offset} = $tz; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
18
|
100
|
100
|
|
|
152
|
if (defined $dt->{seconds} && ! defined $dt->{nanoseconds}) { |
|
31
|
8
|
|
|
|
|
27
|
$dt->{nanoseconds} = 0; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
18
|
100
|
100
|
|
|
115
|
if (! defined $dt->{seconds} && defined $dt->{nanoseconds}) { |
|
34
|
4
|
|
|
|
|
13
|
$dt->{seconds} = 0; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
18
|
|
|
|
|
105
|
return bless $dt, __PACKAGE__; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
52
|
|
|
52
|
1
|
341
|
sub days { shift->{days} } |
|
41
|
54
|
|
|
54
|
1
|
403
|
sub seconds { shift->{seconds} } |
|
42
|
18
|
|
|
18
|
1
|
140
|
sub nanoseconds { shift->{nanoseconds} } |
|
43
|
34
|
|
|
34
|
1
|
220
|
sub tz_offset { shift->{tz_offset} } |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub tz_name { |
|
47
|
22
|
|
|
22
|
1
|
76
|
my ($self) = @_; |
|
48
|
|
|
|
|
|
|
|
|
49
|
22
|
100
|
100
|
|
|
193
|
if ( ! exists $self->{tz_name} && defined $self->{tz_offset} ) { |
|
50
|
10
|
100
|
|
|
|
54
|
if ( $self->{tz_offset} == 0 ) { |
|
51
|
2
|
|
|
|
|
25
|
return $self->{tz_name} = 'Etc/GMT'; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
8
|
|
|
|
|
32
|
my $hours = $self->{tz_offset} / -3600; |
|
54
|
8
|
100
|
100
|
|
|
81
|
if ( $hours != int $hours || $hours > 12 || $hours < -14 ) { |
|
|
|
|
100
|
|
|
|
|
|
55
|
6
|
|
|
|
|
39
|
return $self->{tz_name} = undef; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
2
|
|
|
|
|
13
|
$self->{tz_name} = sprintf 'Etc/GMT%+i', $hours; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
14
|
|
|
|
|
120
|
return $self->{tz_name}; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |