| 1 | package Calendar::Any::Util::Solar; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 3 | $Calendar::Any::Util::Solar::VERSION = '0.5'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Calendar::Any::Gregorian; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use Math::Trig; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 3 | our $timezone = _current_timezone(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | require Exporter; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | timezone next_longitude_date longitude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | ) ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub timezone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
timezone: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $longitude = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | $longitude / 180 * 12 * 60; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | my @data = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | [403406, 4.721964, 1.621043], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | [195207, 5.937458, 62830.348067], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | [119433, 1.115589, 62830.821524], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | [112392, 5.781616, 62829.634302], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | [3891, 5.5474, 125660.5691], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | [2819, 1.5120, 125660.984], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | [1721, 4.1897, 62832.4766], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | [0, 1.163, 0.813], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | [660, 5.415, 125659.31], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | [350, 4.315, 57533.85], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | [334, 4.553, -33.931], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | [314, 5.198, 777137.715], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | [268, 5.989, 78604.191], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | [242, 2.911, 5.412], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | [234, 1.423, 39302.098], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | [158, 0.061, -34.861], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | [132, 2.317, 115067.698], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | [129, 3.193, 15774.337], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | [114, 2.828, 5296.670], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | [99, 0.52, 58849.27], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | [93, 4.65, 5296.11], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | [86, 4.35, -3980.70], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | [78, 2.75, 52237.69], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | [72, 4.50, 55076.47], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | [68, 3.23, 261.08], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | [64, 1.22, 15773.85], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | [46, 0.14, 188491.03], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | [38, 3.44, -7756.55], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | [37, 4.37, 264.89], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | [32, 1.14, 117906.27], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | [29, 2.84, 55075.75], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | [28, 5.96, -7961.39], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | [27, 5.09, 188489.81], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | [27, 1.72, 2132.19], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | [25, 2.56, 109771.03], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | [24, 1.92, 54868.56], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | [21, 0.09, 25443.93], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | [21, 5.98, -55731.43], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | [20, 4.03, 60697.74], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | [18, 4.47, 2132.79], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | [17, 0.79, 109771.63], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | [14, 4.24, -7752.82], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | [13, 2.01, 188491.91], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | [13, 2.65, 207.81], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | [13, 4.98, 29424.63], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | [12, 0.93, -7.99], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | [10, 2.21, 46941.14], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | [10, 3.59, -68.29], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | [10, 1.50, 21463.25], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | [10, 2.55, 157208.40] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | #========================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | # Input : Calendar object or absolute date, the degrees L, timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | # Output : The next *absolute date* that sun's longitude | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # is a multiple of L degrees at that timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | # Desc : timezone default is $timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | #========================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | ▶ | sub next_longitude_date { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_longitude_date: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | my ($d, $l, $tz) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | ▶ | if ( ref $d ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | $d = $d->absolute_date; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | my $long; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 1 | my $start = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 1 | my $start_long = longitude($d, $tz); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 1 | my $next = (int($start_long/$l) + 1) * $l % 360; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | my $end = $d + $l/360*400; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | my $end_long = longitude($end); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | while ( $end-$start > 0.00001 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 22 | $d = ($start + $end)/2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 22 | $long = longitude($d); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 22 | ▶ | if ( (($next != 0) && ($long < $next)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition55%5/9
$next != 0 and $long < $next or $next == 0 and $l < $long
$next != 0 and $long < $next
$next == 0 and $l < $long
MC/DC25%1/4
$next != 0 and $long < $next or $next == 0 and $l < $long
$next != 0
$long < $next
$next == 0
$l < $long
Truth table28%2/7
A and B or C and D
A= $next != 0B= $long < $nextC= $next == 0D= $l < $long
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | || (($next==0) && ($l < $long)) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 8 | $start = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 8 | $start_long = $long; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 14 | $end = $d; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 14 | $end_long = $long; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | return ($start+$end)/2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | #========================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # Input : Calendar object or absolute date, timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # Output : The sun's longitude of the date at that timezone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # Desc : To simplified convertion, use absolute date instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # of astronomical date | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | #========================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 24 | ▶ | sub longitude { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
longitude: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 24 | my $date = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 24 | my $tz = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 24 | ▶ | defined($tz) || ($tz = $timezone); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | # TODO: daylight time offset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 24 | ▶ | $date = Calendar::Any::Gregorian->new((ref $date ? $date->absolute_date : $date) - $tz/60/24); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 24 | $date = $date->astro_date + _ephemeris_correction($date->year); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 24 | my $U = ($date - 2451545)/3652500; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 24 | my $longitude = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 24 | foreach ( @data ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1200 | $longitude += $_->[0] * sin($_->[1]+$U*$_->[2]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 24 | $longitude = 4.9353929 + 62833.1961680 * $U + 0.0000001 * $longitude; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 24 | my $aberration = 0.0000001 *(17 * cos(3.10 + 62830.14 *$U) - 973); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 24 | my $nutation = -0.0000001* (834 * sin(2.19+$U*(0.36*$U - 3375.70)) + 64 * sin(3.51+ $U*(125666.39 + 0.10*$U))); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 24 | return _mod(rad2deg($longitude + $aberration + $nutation), 360); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 24 | ▶ | sub _mod { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mod: called CC=2 SCAR=7.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 24 | my ($num, $base) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 24 | $num = $num - int($num/$base)*$base; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 24 | ▶ | return $num*$base < 0 ? $num+$base : $num; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 30 | ▶ | sub _ephemeris_correction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ephemeris_correction: called CC=9 SCAR=41.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 30 | my $year = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 30 | ▶ | if ( $year > 1988 && $year < 2020 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%1/3
$year > 1988 and $year < 2020
MC/DC0%0/2
$year > 1988 and $year < 2020
$year > 1988
$year < 2020
Truth table33%1/3
A and B
A= $year > 1988B= $year < 2020
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 30 | ($year-2000+67)/60/60/24; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | ▶ | } elsif ( $year>1900 && $year < 1988 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$year > 1900 and $year < 1988
MC/DC0%0/2
$year > 1900 and $year < 1988
$year > 1900
$year < 1988
Truth table0%0/3
A and B
A= $year > 1900B= $year < 1988
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | my $theta = (Calendar::Any::Gregorian->new(7, 1, $year)->astro_date - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | Calendar::Any::Gregorian->new(1, 1, 1900)->astro_date)/36525; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $theta2 = $theta * $theta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | my $theta3 = $theta2 * $theta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my $theta4 = $theta2 * $theta2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | return -0.00002 + 0.000297 * $theta + 0.025184 * $theta2 - 0.181133 * $theta3 + 0.553040 * $theta4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | -0.861938 * $theta2 * $theta3 + 0.677066 * $theta3 * $theta3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | - 0.212591 * $theta3 * $theta4; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ▶ | elsif ( $year>1800 && $year<1900 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$year > 1800 and $year < 1900
MC/DC0%0/2
$year > 1800 and $year < 1900
$year > 1800
$year < 1900
Truth table0%0/3
A and B
A= $year > 1800B= $year < 1900
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $theta = (Calendar::Any::Gregorian->new(7, 1, $year)->astro_date - | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | Calendar::Any::Gregorian->new(1, 1, 1900)->astro_date)/36525; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | my $theta2 = $theta * $theta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $theta3 = $theta2 * $theta; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $theta4 = $theta2 * $theta2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | my $theta5 = $theta3 * $theta2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return -0.000009 + 0.003844*$theta + 0.083563*$theta2 + 0.865736*$theta3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | + 4.867575*$theta4 + 15.845535*$theta5 + 31.332267*$theta3*$theta3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | + 38.291999*$theta4*$theta3 + 28.316289*$theta4*$theta4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | + 11.636204*$theta4*$theta5 + 2.043794*$theta5*$theta5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | ▶ | elsif ( $year>1620 && $year<1800 ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$year > 1620 and $year < 1800
MC/DC0%0/2
$year > 1620 and $year < 1800
$year > 1620
$year < 1800
Truth table0%0/3
A and B
A= $year > 1620B= $year < 1800
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | my $x = ($year-1600)/10; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | return (2.19167 * $x*$x - 40.675*$x + 196.58333)/60/60/24; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $tmp = Calendar::Any::Gregorian->new(1, 1, $year)->astro_date - 2382148; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | return ($tmp * $tmp / 41048480.0 - 15)/60/60/24; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 3 | ▶ | sub _current_timezone { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_current_timezone: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 3 | my @gmtime = gmtime(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 3 | my @localtime = localtime(0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 3 | my $mins = 60*$localtime[2] + $localtime[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 3 | ▶ | return ( $localtime[5] == 70 ) ? $mins : $mins - 24*60; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||