« blib/lib/Astro/App/Satpass2/FormatTime/DateTime/Cldr.pm
↑ Summary
blib/lib/Astro/App/Satpass2/Warner.pm »
| 1 | package Astro::App::Satpass2::FormatTime::POSIX::Strftime; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 20 | ▶ | use parent qw{ Astro::App::Satpass2::FormatTime }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 20 | ▶ | use Astro::Coord::ECI::Utils qw{ gm_strftime local_strftime }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 20 | ▶ | use Astro::App::Satpass2::FormatTime::Strftime; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 20 | ▶ | use Astro::App::Satpass2::Utils qw{ ARRAY_REF @CARP_NOT }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 20 | ▶ | use POSIX (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 20 | our $VERSION = '0.059'; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 618 | ▶ | sub format_datetime { | ||||||||||||||||||||||||||
|
Subroutine
format_datetime: called CC=7 SCAR=23.6
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 618 | my ( $self, $tplt, $time, $gmt ) = @_; | |||||||||||||||||||||||||||
| 19 | 618 | $time = $self->__round_time_value( $time ); | |||||||||||||||||||||||||||
| 20 | 618 | ▶ | defined $gmt or $gmt = $self->gmt(); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | 618 | ▶ | if ( ARRAY_REF eq ref $time ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 22 | # NOTE that this is not documented, and is used only to | ||||||||||||||||||||||||||||
| 23 | # determine the maximum width generated by the given time | ||||||||||||||||||||||||||||
| 24 | # format, so I believe it can stand as-is. IF this is wrong AND | ||||||||||||||||||||||||||||
| 25 | # the strftime() behavior of Perl 5.39.8 and 5.39.9 makes it int | ||||||||||||||||||||||||||||
| 26 | # 5.40, I will need to set the zone to 'GMT' if $gmt is true. | ||||||||||||||||||||||||||||
| 27 | $gmt | ||||||||||||||||||||||||||||
| 28 | 330 | ▶ | and local $ENV{TZ} = 'GMT'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 330 | return POSIX::strftime( $tplt, @{ $time } ); | |||||||||||||||||||||||||||
| 30 | } elsif ( $gmt ) { | ||||||||||||||||||||||||||||
| 31 | 288 | return gm_strftime( $tplt, $time ); | |||||||||||||||||||||||||||
| 32 | } else { | ||||||||||||||||||||||||||||
| 33 | 0 | my $tz = $self->tz(); | |||||||||||||||||||||||||||
| 34 | defined $tz | ||||||||||||||||||||||||||||
| 35 | and $tz ne '' | ||||||||||||||||||||||||||||
| 36 | 0 | ▶ | and local $ENV{TZ} = $tz; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $tz and $tz ne ""
MC/DC0%0/2
defined $tz and $tz ne ""
defined $tz
$tz ne ""
Truth table0%0/3
A and B
A= defined $tzB= $tz ne ""
| |||||||||||||||||||||||||||||
| 37 | 0 | return local_strftime( $tplt, $time ); | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | my %adjuster = ( | ||||||||||||||||||||||||||||
| 43 | 30 | ▶ | year => sub { $_[0][5] = $_[1] - 1900; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | 195 | ▶ | month => sub { $_[0][4] = $_[1] - 1; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | 120 | ▶ | day => sub { $_[0][3] = $_[1]; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 45 | ▶ | hour => sub { $_[0][2] = $_[1]; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | minute => sub { $_[0][1] = $_[1]; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 48 | 0 | ▶ | second => sub { $_[0][0] = $_[1]; return }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 49 | 20 | ); | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 390 | ▶ | sub __format_datetime_width_adjust_object { | ||||||||||||||||||||||||||
|
Subroutine
__format_datetime_width_adjust_object: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 52 | 390 | my ( undef, $obj, $name, $val ) = @_; # Invocant unused | |||||||||||||||||||||||||||
| 53 | 390 | ▶ | $obj or $obj = [ 0, 0, 0, 1, 0, 200 ]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 390 | $adjuster{$name}->( $obj, $val ); | |||||||||||||||||||||||||||
| 55 | 390 | return $obj; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 20 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||