line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Converter::Saka; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1353
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
47
|
|
4
|
1
|
|
|
1
|
|
6
|
use base 'Date::Converter'; |
|
1
|
|
|
|
|
90
|
|
|
1
|
|
|
|
|
102
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
7
|
|
|
|
|
|
|
$VERSION = 1.1; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub ymdf_to_jed { |
10
|
0
|
|
|
0
|
0
|
0
|
my ($y, $m, $d, $f) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
0
|
|
|
|
0
|
$f = 0 unless defined $f; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
0
|
my ($y_prime, $m_prime, $d_prime, $j1, $j2, $z, $g); |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
|
5
|
use integer; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
$y_prime = $y + 4794 - (13 - $m) / 12; |
19
|
0
|
|
|
|
|
0
|
$m_prime = ($m + 10) % 12; |
20
|
0
|
|
|
|
|
0
|
$d_prime = $d - 1; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
$j1 = (1461 * $y_prime) / 4; |
23
|
0
|
|
|
|
|
0
|
$z = $m_prime / 6; |
24
|
0
|
|
|
|
|
0
|
$j2 = (31 - $z) * $m_prime + 5 * $z; |
25
|
0
|
|
|
|
|
0
|
$g = 3 * (($y_prime + 184) / 100) / 4 - 36; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
my $jed = $j1 + $j2 + $d_prime - 1348 - $g - 0.5; |
29
|
0
|
|
|
|
|
0
|
$jed += $f; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
return $jed; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub jed_to_ymdf { |
35
|
33
|
|
|
33
|
0
|
26140
|
my ($jed) = @_; |
36
|
|
|
|
|
|
|
|
37
|
33
|
|
|
|
|
62
|
my $j = int ($jed + 0.5); |
38
|
33
|
|
|
|
|
53
|
my $f = ($jed + 0.5) - $j; |
39
|
|
|
|
|
|
|
|
40
|
33
|
|
|
|
|
32
|
my ($g, $j_prime, $y_prime, $t_prime, $x, $z, $s, $m_prime, $d_prime, $y, $m, $d); |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
|
191
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
|
33
|
|
|
|
|
40
|
|
43
|
|
|
|
|
|
|
|
44
|
33
|
|
|
|
|
52
|
$g = 3 * ((4 * $j + 274073) / 146097) / 4 - 36; |
45
|
|
|
|
|
|
|
|
46
|
33
|
|
|
|
|
36
|
$j_prime = $j + 1348 + $g; |
47
|
33
|
|
|
|
|
35
|
$y_prime = (4 * $j_prime + 3) / 1461; |
48
|
33
|
|
|
|
|
40
|
$t_prime = ((4 * $j_prime + 3) % 1461 ) / 4; |
49
|
|
|
|
|
|
|
|
50
|
33
|
|
|
|
|
32
|
$x = $t_prime / 365; |
51
|
33
|
|
|
|
|
36
|
$z = $t_prime / 185 - $x; |
52
|
33
|
|
|
|
|
31
|
$s = 31 - $z; |
53
|
|
|
|
|
|
|
|
54
|
33
|
|
|
|
|
47
|
$m_prime = ($t_prime - 5 * $z ) / $s; |
55
|
33
|
|
|
|
|
46
|
$d_prime = 6 * $x + (($t_prime - 5 * $z) % $s); |
56
|
|
|
|
|
|
|
|
57
|
33
|
|
|
|
|
31
|
$d = $d_prime + 1; |
58
|
33
|
|
|
|
|
44
|
$m = (($m_prime + 1) % 12 ) + 1; |
59
|
33
|
|
|
|
|
43
|
$y = $y_prime - 4794 + (13 - $m) / 12; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
33
|
|
|
|
|
288
|
return ($y, $m, $d, $f); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |