line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::Piece::DB2; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
22095
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
64
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = '0.05'; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
3793
|
use Time::Piece; |
|
1
|
|
|
|
|
40965
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
7
|
sub import { shift; @_ = ('Time::Piece', @_); goto &Time::Piece::import } |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Time::Piece; |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
108
|
use Time::Seconds; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
444
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# BEGIN |
18
|
|
|
|
|
|
|
# { |
19
|
|
|
|
|
|
|
# my $has_dst_bug = |
20
|
|
|
|
|
|
|
# Time::Piece->strptime( '20000601120000', '%Y%m%d%H%M%S' )->hour != 12; |
21
|
|
|
|
|
|
|
# sub HAS_DST_BUG () { $has_dst_bug } |
22
|
|
|
|
|
|
|
# } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub db2_date |
25
|
|
|
|
|
|
|
{ |
26
|
8
|
|
|
8
|
0
|
1416
|
my $self = shift; |
27
|
8
|
|
|
|
|
24
|
my $old_sep = $self->date_separator('-'); |
28
|
8
|
|
|
|
|
87
|
my $ymd = $self->ymd; |
29
|
8
|
|
|
|
|
204
|
$self->date_separator($old_sep); |
30
|
8
|
|
|
|
|
71
|
return $ymd; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub db2_time |
34
|
|
|
|
|
|
|
{ |
35
|
8
|
|
|
8
|
0
|
1451
|
my $self = shift; |
36
|
8
|
|
|
|
|
19
|
my $old_sep = $self->time_separator(':'); |
37
|
8
|
|
|
|
|
71
|
my $hms = $self->hms; |
38
|
8
|
|
|
|
|
67
|
$self->time_separator($old_sep); |
39
|
8
|
|
|
|
|
79
|
return $hms; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub db2_timestamp |
43
|
|
|
|
|
|
|
{ |
44
|
5
|
|
|
5
|
0
|
1165
|
my $self = shift; |
45
|
5
|
|
|
|
|
11
|
return join ' ', $self->db2_date, $self->db2_time; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub from_db2_date |
49
|
|
|
|
|
|
|
{ |
50
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
51
|
1
|
|
|
|
|
4
|
return $class->strptime( shift, '%Y-%m-%d' ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub from_db2_time |
55
|
|
|
|
|
|
|
{ |
56
|
1
|
|
|
1
|
0
|
3
|
my ($class,$tstamp) = @_; |
57
|
1
|
|
|
|
|
3
|
$tstamp = substr($tstamp,0,length($tstamp)-7); |
58
|
1
|
|
|
|
|
4
|
return $class->strptime( $tstamp, '%H:%M:%S' ); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub from_db2_timestamp |
62
|
|
|
|
|
|
|
{ |
63
|
1
|
|
|
1
|
0
|
2
|
my ($class,$tstamp) = @_; |
64
|
1
|
|
|
|
|
2
|
$tstamp = substr($tstamp,0,length($tstamp)-7); |
65
|
1
|
|
|
|
|
5
|
my $time = $class->strptime( $tstamp, '%Y-%m-%d %H:%M:%S' ); |
66
|
1
|
|
|
|
|
36
|
return $time; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |