line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Converter::Persian; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1631
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
5
|
use base 'Date::Converter'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
112
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
97
|
|
7
|
|
|
|
|
|
|
$VERSION = 1.1; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# E G Richards, |
10
|
|
|
|
|
|
|
# Algorithm E, |
11
|
|
|
|
|
|
|
# Mapping Time, The Calendar and Its History, |
12
|
|
|
|
|
|
|
# Oxford, 1999, pages 323-324. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub ymdf_to_jed { |
15
|
0
|
|
|
0
|
0
|
0
|
my ($y, $m, $d, $f) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
my ($y_prime, $m_prime, $d_prime); |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
1
|
|
5
|
use integer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
|
0
|
|
|
|
|
0
|
|
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
0
|
$y_prime = $y + 5348 - (22 - $m) / 13; |
22
|
0
|
|
|
|
|
0
|
$m_prime = ($m + 3) % 13; |
23
|
0
|
|
|
|
|
0
|
$d_prime = $d - 1; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
0
|
my $jed = 365 * $y_prime + 30 * $m_prime + $d_prime - 77 - 0.5; |
27
|
0
|
|
|
|
|
0
|
$jed += $f; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
return $jed; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub jed_to_ymdf { |
33
|
32
|
|
|
32
|
0
|
17432
|
my ($jed) = @_; |
34
|
|
|
|
|
|
|
|
35
|
32
|
|
|
|
|
64
|
my $j = int ($jed + 0.5); |
36
|
32
|
|
|
|
|
55
|
my $f = ($jed + 0.5) - $j; |
37
|
|
|
|
|
|
|
|
38
|
32
|
|
|
|
|
34
|
my ($j_prime, $y_prime, $t_prime, $m_prime, $d_prime, $y, $m, $d); |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
|
152
|
use integer; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
3
|
|
|
32
|
|
|
|
|
35
|
|
41
|
|
|
|
|
|
|
|
42
|
32
|
|
|
|
|
38
|
$j_prime = $j + 77; |
43
|
|
|
|
|
|
|
|
44
|
32
|
|
|
|
|
37
|
$y_prime = $j_prime / 365; |
45
|
32
|
|
|
|
|
34
|
$t_prime = $j_prime %365; |
46
|
32
|
|
|
|
|
32
|
$m_prime = $t_prime / 30; |
47
|
32
|
|
|
|
|
34
|
$d_prime = $t_prime % 30; |
48
|
|
|
|
|
|
|
|
49
|
32
|
|
|
|
|
28
|
$d = $d_prime + 1; |
50
|
32
|
|
|
|
|
35
|
$m = (($m_prime + 9) % 13) + 1; |
51
|
32
|
|
|
|
|
43
|
$y = $y_prime - 5348 + (22 - $m) / 13; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
32
|
|
|
|
|
415
|
return ($y, $m, $d, $f); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |