line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Date::Converter::Hebrew; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1199
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
6
|
use base 'Date::Converter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
95
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
976
|
|
7
|
|
|
|
|
|
|
$VERSION = 1.1; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub ymdf_to_jed { |
10
|
789
|
|
|
789
|
0
|
1171
|
my ($y, $m, $d, $f) = @_; |
11
|
|
|
|
|
|
|
|
12
|
789
|
50
|
|
|
|
1528
|
$f = 0 unless $f; |
13
|
|
|
|
|
|
|
|
14
|
789
|
|
|
|
|
1316
|
my $months = year_months($y); |
15
|
789
|
|
|
|
|
1541
|
my $jed = epoch() + delay_1($y) + delay_2($y) + $d + 1; |
16
|
|
|
|
|
|
|
|
17
|
789
|
100
|
|
|
|
1550
|
if ($m < 7) { |
18
|
99
|
|
|
|
|
202
|
for (my $mon = 7; $mon <= $months; $mon++) { |
19
|
620
|
|
|
|
|
1079
|
$jed += month_days($y, $mon); |
20
|
|
|
|
|
|
|
} |
21
|
99
|
|
|
|
|
247
|
for (my $mon = 1; $mon < $m; $mon++) { |
22
|
99
|
|
|
|
|
153
|
$jed += month_days($y, $mon); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} else { |
25
|
690
|
|
|
|
|
1608
|
for (my $mon = 7; $mon < $m; $mon++) { |
26
|
126
|
|
|
|
|
209
|
$jed += month_days($y, $mon); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
789
|
|
|
|
|
921
|
$jed += $f; |
31
|
|
|
|
|
|
|
|
32
|
789
|
|
|
|
|
2446
|
return $jed; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub jed_to_ymdf { |
36
|
31
|
|
|
31
|
0
|
14915
|
my ($jed) = @_; |
37
|
|
|
|
|
|
|
|
38
|
31
|
|
|
|
|
37
|
my ($y, $m, $d); |
39
|
|
|
|
|
|
|
|
40
|
31
|
|
|
|
|
61
|
$jed = int($jed) + 0.5; |
41
|
31
|
|
|
|
|
53
|
my $count = int((($jed - epoch()) * 98496.0) / 35975351.0); |
42
|
31
|
|
|
|
|
40
|
$y = $count - 1; |
43
|
31
|
|
|
|
|
66
|
for (my $i = $count; $jed >= ymdf_to_jed($i, 7, 1); $i++) { |
44
|
64
|
|
|
|
|
133
|
$y++; |
45
|
|
|
|
|
|
|
} |
46
|
31
|
100
|
|
|
|
61
|
my $first = ($jed < ymdf_to_jed($y, 1, 1)) ? 7 : 1; |
47
|
31
|
|
|
|
|
47
|
$m = $first; |
48
|
31
|
|
|
|
|
71
|
for (my $i = $first; $jed > ymdf_to_jed($y, $i, month_days($y, $i)); $i++) { |
49
|
65
|
|
|
|
|
154
|
$m++; |
50
|
|
|
|
|
|
|
} |
51
|
31
|
|
|
|
|
60
|
$d = ($jed - ymdf_to_jed($y, $m, 1)) + 1; |
52
|
|
|
|
|
|
|
|
53
|
31
|
|
|
|
|
356
|
return ($y, $m, $d, 0); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub epoch { |
57
|
820
|
|
|
820
|
0
|
1482
|
return 347995.5; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub leap { |
61
|
896
|
|
|
896
|
0
|
954
|
my ($y) = @_; |
62
|
|
|
|
|
|
|
|
63
|
896
|
|
|
|
|
3080
|
return ((($y * 7) + 1) % 19) < 7; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub year_months { |
67
|
789
|
|
|
789
|
0
|
855
|
my ($y) = @_; |
68
|
|
|
|
|
|
|
|
69
|
789
|
100
|
|
|
|
1165
|
return leap($y) ? 13 : 12; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub delay_1 { |
73
|
3156
|
|
|
3156
|
0
|
3451
|
my ($y) = @_; |
74
|
|
|
|
|
|
|
|
75
|
3156
|
|
|
|
|
4555
|
my $months = int(((235 * $y) - 234) / 19); |
76
|
3156
|
|
|
|
|
3923
|
my $parts = 12084 + (13753 * $months); |
77
|
3156
|
|
|
|
|
4401
|
my $days = ($months * 29) + int($parts / 25920); |
78
|
|
|
|
|
|
|
|
79
|
3156
|
100
|
|
|
|
6851
|
if (((3 * ($days + 1)) % 7) < 3) { |
80
|
1395
|
|
|
|
|
1518
|
$days++; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
3156
|
|
|
|
|
5661
|
return $days; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub delay_2 { |
87
|
789
|
|
|
789
|
0
|
857
|
my ($y) = @_; |
88
|
|
|
|
|
|
|
|
89
|
789
|
|
|
|
|
1281
|
my $last = delay_1($y - 1); |
90
|
789
|
|
|
|
|
1409
|
my $present = delay_1($y); |
91
|
789
|
|
|
|
|
1898
|
my $next = delay_1($y + 1); |
92
|
|
|
|
|
|
|
|
93
|
789
|
100
|
|
|
|
2784
|
return (($next - $present) == 356) ? 2 : ((($present - $last) == 382) ? 1 : 0); |
|
|
100
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub year_days { |
97
|
268
|
|
|
268
|
0
|
314
|
my ($y) = @_; |
98
|
|
|
|
|
|
|
|
99
|
268
|
|
|
|
|
523
|
return ymdf_to_jed($y + 1, 7, 1) - ymdf_to_jed($y, 7, 1); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub month_days { |
103
|
941
|
|
|
941
|
0
|
1707
|
my ($y, $m) = @_; |
104
|
|
|
|
|
|
|
|
105
|
941
|
100
|
100
|
|
|
8766
|
if ($m == 2 || $m == 4 || $m == 6 || |
|
|
|
66
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
106
|
|
|
|
|
|
|
$m == 10 || $m == 13) { |
107
|
205
|
|
|
|
|
665
|
return 29; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
736
|
100
|
100
|
|
|
1774
|
if ($m == 12 && !leap($y)) { |
111
|
74
|
|
|
|
|
270
|
return 29; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
662
|
100
|
100
|
|
|
1410
|
if ($m == 8 && !((year_days($y) % 10) == 5)) { |
115
|
73
|
|
|
|
|
243
|
return 29; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
589
|
100
|
100
|
|
|
1350
|
if ($m == 9 && ((year_days($y) % 10) == 3)) { |
119
|
38
|
|
|
|
|
126
|
return 29; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
551
|
|
|
|
|
1665
|
return 30; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |