line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Converter::Bahai; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3591
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
52
|
|
4
|
1
|
|
|
1
|
|
7
|
use base 'Date::Converter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
276
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
379
|
|
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, $g); |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
|
6
|
use integer; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
0
|
|
|
|
|
0
|
|
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
$y_prime = $y + 6560 - (39 - $m) / 20; |
19
|
0
|
|
|
|
|
0
|
$m_prime = $m % 20; |
20
|
0
|
|
|
|
|
0
|
$d_prime = $d - 1; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
$j1 = (1461 * $y_prime) / 4; |
23
|
0
|
|
|
|
|
0
|
$j2 = 19 * $m_prime; |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
0
|
$g = 3 * (($y_prime + 184) / 100) / 4 - 50; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
0
|
my $jed = $j1 + $j2 + $d_prime - 1412 - $g - 0.5; |
29
|
0
|
|
|
|
|
0
|
$jed += $f; |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
return $jed; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub jed_to_ymdf { |
35
|
9
|
|
|
9
|
0
|
8081
|
my ($jed) = @_; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
|
|
86
|
my $j = int ($jed + 0.5); |
38
|
9
|
|
|
|
|
16
|
my $f = ($jed + 0.5) - $j; |
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
|
|
9
|
my ($g, $j_prime, $y_prime, $t_prime, $m_prime, $d_prime, $y, $m, $d); |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
|
331
|
use integer; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
6
|
|
|
9
|
|
|
|
|
207
|
|
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
129
|
$g = 3 * ((4 * $j + 274273) / 146097) / 4 - 50; |
45
|
9
|
|
|
|
|
12
|
$j_prime = $j + 1412 + $g; |
46
|
|
|
|
|
|
|
|
47
|
9
|
|
|
|
|
14
|
$y_prime = (4 * $j_prime + 3) / 1461; |
48
|
9
|
|
|
|
|
12
|
$t_prime = ((4 * $j_prime + 3) % 1461 ) / 4; |
49
|
9
|
|
|
|
|
10
|
$m_prime = $t_prime / 19; |
50
|
9
|
|
|
|
|
9
|
$d_prime = $t_prime % 19; |
51
|
|
|
|
|
|
|
|
52
|
9
|
|
|
|
|
29
|
$d = $d_prime + 1; |
53
|
9
|
|
|
|
|
11
|
$m = (($m_prime + 19) % 20) + 1; |
54
|
9
|
|
|
|
|
14
|
$y = $y_prime - 6560 + (39 - $m) / 20; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
9
|
|
|
|
|
108
|
return ($y, $m, $d, $f); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |