line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Astro::App::Satpass2::FormatTime::POSIX::Strftime; |
2
|
|
|
|
|
|
|
|
3
|
20
|
|
|
20
|
|
326
|
use 5.008; |
|
20
|
|
|
|
|
72
|
|
4
|
|
|
|
|
|
|
|
5
|
20
|
|
|
20
|
|
117
|
use strict; |
|
20
|
|
|
|
|
57
|
|
|
20
|
|
|
|
|
406
|
|
6
|
20
|
|
|
20
|
|
98
|
use warnings; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
577
|
|
7
|
|
|
|
|
|
|
|
8
|
20
|
|
|
20
|
|
102
|
use parent qw{ Astro::App::Satpass2::FormatTime }; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
107
|
|
9
|
|
|
|
|
|
|
|
10
|
20
|
|
|
20
|
|
10606
|
use Astro::App::Satpass2::FormatTime::Strftime; |
|
20
|
|
|
|
|
63
|
|
|
20
|
|
|
|
|
1264
|
|
11
|
20
|
|
|
20
|
|
155
|
use Astro::App::Satpass2::Utils qw{ ARRAY_REF @CARP_NOT }; |
|
20
|
|
|
|
|
46
|
|
|
20
|
|
|
|
|
1586
|
|
12
|
20
|
|
|
20
|
|
176
|
use POSIX (); |
|
20
|
|
|
|
|
54
|
|
|
20
|
|
|
|
|
8855
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.052'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub format_datetime { |
17
|
618
|
|
|
618
|
1
|
1437
|
my ( $self, $tplt, $time, $gmt ) = @_; |
18
|
618
|
|
|
|
|
1611
|
$time = $self->__round_time_value( $time ); |
19
|
618
|
100
|
|
|
|
2166
|
defined $gmt or $gmt = $self->gmt(); |
20
|
618
|
|
|
|
|
1075
|
my @parts; |
21
|
618
|
100
|
|
|
|
1814
|
if ( ARRAY_REF eq ref $time ) { |
|
|
50
|
|
|
|
|
|
22
|
330
|
|
|
|
|
512
|
@parts = @{ $time }; |
|
330
|
|
|
|
|
675
|
|
23
|
|
|
|
|
|
|
} elsif ( $gmt ) { |
24
|
288
|
|
|
|
|
1350
|
@parts = gmtime $time; |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
|
|
|
0
|
my $tz = $self->tz(); |
27
|
|
|
|
|
|
|
defined $tz |
28
|
|
|
|
|
|
|
and $tz ne '' |
29
|
0
|
0
|
0
|
|
|
0
|
and local $ENV{TZ} = $tz; |
30
|
0
|
|
|
|
|
0
|
@parts = localtime $time; |
31
|
|
|
|
|
|
|
} |
32
|
618
|
|
|
|
|
23470
|
return POSIX::strftime( $tplt, @parts ); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
{ |
36
|
|
|
|
|
|
|
my %adjuster = ( |
37
|
|
|
|
|
|
|
year => sub { $_[0][5] = $_[1] - 1900; return }, |
38
|
|
|
|
|
|
|
month => sub { $_[0][4] = $_[1] - 1; return }, |
39
|
|
|
|
|
|
|
day => sub { $_[0][3] = $_[1]; return }, |
40
|
|
|
|
|
|
|
hour => sub { $_[0][2] = $_[1]; return }, |
41
|
|
|
|
|
|
|
minute => sub { $_[0][1] = $_[1]; return }, |
42
|
|
|
|
|
|
|
second => sub { $_[0][0] = $_[1]; return }, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub __format_datetime_width_adjust_object { |
46
|
390
|
|
|
390
|
|
854
|
my ( undef, $obj, $name, $val ) = @_; # Invocant unused |
47
|
390
|
100
|
|
|
|
877
|
$obj or $obj = [ 0, 0, 0, 1, 0, 200 ]; |
48
|
390
|
|
|
|
|
2102
|
$adjuster{$name}->( $obj, $val ); |
49
|
390
|
|
|
|
|
805
|
return $obj; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |