when_exe 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.ja.txt +25 -25
- data/LICENSE.txt +31 -31
- data/bin/locales.rb +2 -1
- data/bin/when.rb.config +1 -1
- data/lib/when_exe.rb +70 -48
- data/lib/when_exe/basictypes.rb +99 -65
- data/lib/when_exe/calendartypes.rb +40 -178
- data/lib/when_exe/coordinates.rb +156 -62
- data/lib/when_exe/core/compatibility.rb +10 -0
- data/lib/when_exe/core/extension.rb +40 -0
- data/lib/when_exe/ephemeris.rb +112 -50
- data/lib/when_exe/icalendar.rb +125 -91
- data/lib/when_exe/inspect.rb +100 -48
- data/lib/when_exe/locales/ar.rb +48 -48
- data/lib/when_exe/locales/bg.rb +1 -1
- data/lib/when_exe/locales/bs.rb +4 -2
- data/lib/when_exe/locales/ca.rb +1 -1
- data/lib/when_exe/locales/en_CA.rb +3 -4
- data/lib/when_exe/locales/en_IE.rb +88 -0
- data/lib/when_exe/locales/en_US.rb +87 -0
- data/lib/when_exe/locales/es_CR.rb +84 -0
- data/lib/when_exe/locales/es_EC.rb +85 -0
- data/lib/when_exe/locales/es_PA.rb +85 -0
- data/lib/when_exe/locales/fr.rb +39 -39
- data/lib/when_exe/locales/hu.rb +15 -14
- data/lib/when_exe/locales/it.rb +1 -1
- data/lib/when_exe/locales/ja.rb +2 -2
- data/lib/when_exe/locales/locales.rb +7 -0
- data/lib/when_exe/locales/lt.rb +21 -19
- data/lib/when_exe/locales/ms.rb +84 -0
- data/lib/when_exe/locales/nl.rb +2 -2
- data/lib/when_exe/locales/ru.rb +1 -1
- data/lib/when_exe/locales/uk.rb +1 -1
- data/lib/when_exe/locales/ur.rb +84 -0
- data/lib/when_exe/mini_application.rb +44 -43
- data/lib/when_exe/parts/enumerator.rb +3 -3
- data/lib/when_exe/parts/geometric_complex.rb +6 -1
- data/lib/when_exe/parts/locale.rb +49 -18
- data/lib/when_exe/parts/method_cash.rb +61 -0
- data/lib/when_exe/parts/resource.rb +221 -106
- data/lib/when_exe/parts/timezone.rb +70 -33
- data/lib/when_exe/region/bahai.rb +2 -2
- data/lib/when_exe/region/balinese.rb +40 -43
- data/lib/when_exe/region/chinese.rb +93 -33
- data/lib/when_exe/region/chinese_calendar.rb +117 -1
- data/lib/when_exe/region/chinese_epoch.rb +65 -10
- data/lib/when_exe/region/christian.rb +97 -2
- data/lib/when_exe/region/ephemeric_notes.rb +353 -0
- data/lib/when_exe/region/french.rb +1 -1
- data/lib/when_exe/region/geologicalage.rb +171 -171
- data/lib/when_exe/region/indian.rb +18 -14
- data/lib/when_exe/region/iranian.rb +1 -1
- data/lib/when_exe/region/japanese.rb +49 -12
- data/lib/when_exe/region/japanese_notes.rb +838 -507
- data/lib/when_exe/region/japanese_residues.rb +724 -662
- data/lib/when_exe/region/javanese.rb +7 -7
- data/lib/when_exe/region/mayan.rb +19 -17
- data/lib/when_exe/region/nihon_shoki.rb +3 -3
- data/lib/when_exe/region/residue.rb +29 -28
- data/lib/when_exe/region/shire.rb +2 -2
- data/lib/when_exe/region/tibetan.rb +87 -5
- data/lib/when_exe/region/world.rb +1 -1
- data/lib/when_exe/timestandard.rb +85 -7
- data/lib/when_exe/tmobjects.rb +32 -4
- data/lib/when_exe/tmposition.rb +104 -55
- data/lib/when_exe/tmreference.rb +157 -60
- data/lib/when_exe/version.rb +2 -2
- data/test/examples/JapanHolidays.ics +3 -3
- data/test/examples/JapanHolidaysRFC6350.ics +499 -0
- data/test/examples/Residue.m17n +3 -2
- data/test/examples/Spatial.m17n +3 -3
- data/test/examples/USA-DST.ics +27 -27
- data/test/examples/today.rb +1 -1
- data/test/test.rb +4 -2
- data/test/test/basictypes.rb +40 -15
- data/test/test/coordinates.rb +9 -4
- data/test/test/icalendar.rb +24 -14
- data/test/test/inspect.rb +5 -3
- data/test/test/parts.rb +11 -2
- data/test/test/region/chinese.rb +4 -4
- data/test/test/region/civil.rb +124 -0
- data/test/test/region/geologicalage.rb +5 -2
- data/test/test/region/indian.rb +2 -0
- data/test/test/region/japanese.rb +156 -1
- data/test/test/region/jewish.rb +3 -3
- data/test/test/region/m17n.rb +9 -9
- data/test/test/region/mayan.rb +122 -5
- data/test/test/region/residue.rb +1 -1
- data/test/test/tmobjects.rb +27 -64
- data/test/test/tmposition.rb +48 -1
- data/test/test/tmreference.rb +66 -4
- data/when_exe.gemspec +1 -1
- metadata +15 -6
@@ -138,20 +138,20 @@ module When
|
|
138
138
|
class TM::CalendarEra
|
139
139
|
|
140
140
|
# シャカ紀元
|
141
|
-
|
141
|
+
JavaneseLunar = [self, [
|
142
142
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
143
143
|
"locale:[=en:, ja=ja:, alias]",
|
144
144
|
"period:[JavaneseLunar=, ジャワ・イスラーム暦=]",
|
145
|
-
["[
|
146
|
-
|
147
|
-
|
145
|
+
["[SE=, サカ暦=, alias:Javanese_Saka_Era]1547.1.1", "Calendar Epoch", "1035-01-01^Javanese1547",
|
146
|
+
"1163-01-01^Javanese1675",
|
147
|
+
"1237-01-01^Javanese1749", '+Infinity']
|
148
148
|
]]
|
149
149
|
end
|
150
150
|
|
151
151
|
module CalendarTypes
|
152
152
|
|
153
153
|
#
|
154
|
-
# Javanese Calendar (
|
154
|
+
# Javanese Calendar (SE1547-1674) : Dal年 - 閏年
|
155
155
|
#
|
156
156
|
Javanese1547 = [CyclicTableBased, {
|
157
157
|
'origin_of_LSC' => 2317690,
|
@@ -169,7 +169,7 @@ module When
|
|
169
169
|
}]
|
170
170
|
|
171
171
|
#
|
172
|
-
# Javanese Calendar (
|
172
|
+
# Javanese Calendar (SE1675-1748) : Dal年 - 平年
|
173
173
|
#
|
174
174
|
Javanese1675 = [CyclicTableBased, {
|
175
175
|
'origin_of_LSC' => 2360214,
|
@@ -187,7 +187,7 @@ module When
|
|
187
187
|
}]
|
188
188
|
|
189
189
|
#
|
190
|
-
# Javanese Calendar (
|
190
|
+
# Javanese Calendar (SE1749-) : Dal年 - 平年,月日別配当
|
191
191
|
#
|
192
192
|
Javanese1749 = [CyclicTableBased, {
|
193
193
|
'origin_of_LSC' => 2385728,
|
@@ -10,13 +10,14 @@ module When
|
|
10
10
|
module Coordinates
|
11
11
|
|
12
12
|
# Mayan Residue
|
13
|
-
Mayan = [
|
13
|
+
Mayan = [{'Epoch' => {'0D'=>{'Haab'=>'-65', 'Trecena'=> '8', 'Tzolkin'=>'4', 'LoN'=>'3'},
|
14
|
+
'2D'=>{'Haab'=>'-63', 'Trecena'=>'10', 'Tzolkin'=>'6', 'LoN'=>'5'}}}, BasicTypes::M17n, [
|
14
15
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
15
16
|
"locale:[=en:, ja=ja:, alias]",
|
16
17
|
"names:[Mayan]",
|
17
18
|
|
18
19
|
[Residue,
|
19
|
-
"label:[Haab', ハアブ, Haab]", "divisor:365",
|
20
|
+
"label:[Haab', ハアブ, Haab]", "divisor:365", 'day:#{Haab:-65}', "format:[%2$d%1$s/365]",
|
20
21
|
"namespace:[glyph=http://en.wikipedia.org/wiki/File:Maya-]",
|
21
22
|
[Residue, "label:[Pop =glyph:Pop.jpg, ポプ, Pop ]", "remainder: 0"],
|
22
23
|
[Residue, "label:[Wo' =glyph:Dresden-wo.jpg, ウオ, Wo ]", "remainder: 20"],
|
@@ -40,12 +41,12 @@ module When
|
|
40
41
|
],
|
41
42
|
|
42
43
|
[Residue,
|
43
|
-
"label:[Trecena, トレセナ=, Trecena]", "divisor:13",
|
44
|
+
"label:[Trecena, トレセナ=, Trecena]", "divisor:13", 'day:#{Trecena:8}', "format:[%1$s(%3$d/13)]"
|
44
45
|
],
|
45
46
|
|
46
47
|
[Residue,
|
47
48
|
"namespace:[glyph=http://en.wikipedia.org/wiki/File:MAYA-g-log-cal-]",
|
48
|
-
"label:[Tzolk'in, ツォルキン, Tzolkin]", "divisor:20",
|
49
|
+
"label:[Tzolk'in, ツォルキン, Tzolkin]", "divisor:20", 'day:#{Tzolkin:4}', "format:[%s(%d/20)]",
|
49
50
|
[Residue, "label:[Imix' =glyph:D01-Imix.png, イミシュ, Imix =glyph:D01-Imix-cdxW.png ]", "remainder: 0"],
|
50
51
|
[Residue, "label:[Ik' =glyph:D02-Ik.png, イック, Ik =glyph:D02-Ik-cdxW.png ]", "remainder: 1"],
|
51
52
|
[Residue, "label:[Ak'b'al =glyph:D03-Akbal.png, アクバル, Akbal =glyph:D03-Akbal-cdxW.png ]", "remainder: 2"],
|
@@ -70,7 +71,7 @@ module When
|
|
70
71
|
|
71
72
|
[Residue,
|
72
73
|
"namespace:[glyph=http://www.pauahtun.org/G/G]",
|
73
|
-
"label:[Lords_of_the_Night, 夜の九王]", "divisor:9",
|
74
|
+
"label:[Lords_of_the_Night, 夜の九王]", "divisor:9", 'day:#{LoN:3}', "format:[%s(%d/9)]",
|
74
75
|
[Residue, "label:[G9=glyph:9_m.png]", "remainder: 0"],
|
75
76
|
[Residue, "label:[G1=glyph:1_m.png]", "remainder: 1"],
|
76
77
|
[Residue, "label:[G2=glyph:2_m.png]", "remainder: 2"],
|
@@ -89,11 +90,12 @@ module When
|
|
89
90
|
#
|
90
91
|
# Mayan Long Count
|
91
92
|
#
|
92
|
-
|
93
|
+
LongCount = [{'Epoch'=>{'0D' => {'Base' => '?Epoch=0D'},
|
94
|
+
'2D' => {'Base' => '?Epoch=2D'}}}, self, [
|
93
95
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
94
96
|
"locale:[=en:, ja=ja:, alias]",
|
95
|
-
|
96
|
-
["[PHLC=, 先史時代=, PreHistoricLongCount=]0.0.0.0.0", "[Pre Historic=]",
|
97
|
+
'area:[LongCount#{Base}=en:Mesoamerican_Long_Count_calendar, マヤ長期暦=ja:%%<長期暦>]',
|
98
|
+
["[PHLC=, 先史時代=, PreHistoricLongCount=]0.0.0.0.0", "[Pre Historic=]", '-13.0.0.0.0^LongCount#{Base}'],
|
97
99
|
["[HLC=, 歴史時代=, HistoricLongCount=]0.0.0.0.1", "[Historic Age=]", "0.0.0.0.1"],
|
98
100
|
["[NLC=, 新時代=, NewLongCount=]0.0.0.0.1", "[New Age=]", "13.0.0.0.1", "26.0.0.0.1"]
|
99
101
|
]]
|
@@ -101,22 +103,22 @@ module When
|
|
101
103
|
|
102
104
|
module CalendarTypes
|
103
105
|
|
106
|
+
_c20 = Coordinates::Index.new({:base=>0, :unit=>20})
|
107
|
+
_c18 = Coordinates::Index.new({:base=>0, :unit=>18})
|
108
|
+
|
104
109
|
#
|
105
110
|
# Mayan Long Count
|
106
111
|
#
|
107
|
-
LongCount = [
|
112
|
+
LongCount = [{'Epoch'=>{'0D' => {'origin_of_LSC' => 584283, 'Base'=>'?Epoch=0D'},
|
113
|
+
'2D' => {'origin_of_LSC' => 584285, 'Base'=>'?Epoch=2D'}}}, CyclicTableBased, {
|
108
114
|
'origin_of_LSC' => 584283,
|
109
115
|
'rule_table' => {
|
110
116
|
'T' => {'Rule' =>[360]},
|
111
|
-
360 => {'Length'=>[20] * 18}
|
117
|
+
360 => {'Length'=>[20] * 18}
|
118
|
+
},
|
112
119
|
'index_of_MSC' => 2,
|
113
|
-
'indices'=> [
|
114
|
-
|
115
|
-
Coordinates::Index.new({:base=>0, :unit=>20}),
|
116
|
-
Coordinates::Index.new({:base=>0, :unit=>18}),
|
117
|
-
Coordinates::Index.new({:base=>0, :unit=>20}),
|
118
|
-
],
|
119
|
-
'note' => 'MayanNotes'
|
120
|
+
'indices'=> [_c20, _c20, _c18, _c20],
|
121
|
+
'note' => 'MayanNotes#{Base}'
|
120
122
|
}]
|
121
123
|
end
|
122
124
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
=begin
|
3
|
-
Copyright (C) 2011-
|
3
|
+
Copyright (C) 2011-2014 Takashi SUGA
|
4
4
|
|
5
5
|
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
6
6
|
=end
|
@@ -14,7 +14,7 @@ class When::TM::CalendarEra
|
|
14
14
|
"namespace:[ja=http://ja.wikipedia.org/wiki/, en=http://en.wikipedia.org/wiki/]",
|
15
15
|
"locale:[=ja:, en=en:, alias]",
|
16
16
|
"area:[日本]",
|
17
|
-
["[皇紀]1", "@A", "-659-01-01^Chinese
|
17
|
+
["[皇紀]1", "@A", "-659-01-01^Chinese::平朔儀鳳暦"],
|
18
18
|
["[皇紀]1113", "[::_m:EpochEvents::CalendarReform]", "0453-12-14^Chinese::元嘉暦"],
|
19
19
|
["[皇紀]1253", "", "0593-01-01^Japanese"],
|
20
20
|
["[皇紀]2533", "[::_m:EpochEvents::CalendarReform]", "1873-01-01^Gregorian"]
|
@@ -27,7 +27,7 @@ class When::TM::CalendarEra
|
|
27
27
|
"namespace:[ja=http://ja.wikipedia.org/wiki/, en=http://en.wikipedia.org/wiki/]",
|
28
28
|
"locale:[=ja:, en=en:, alias]",
|
29
29
|
"period:[(日本書紀)=ja:%%<日本書紀>, (Nihon_Shoki)=en:Nihon_Shoki]",
|
30
|
-
["[神武]1", "@A", "name=[神武];-659-01-01^Chinese
|
30
|
+
["[神武]1", "@A", "name=[神武];-659-01-01^Chinese::平朔儀鳳暦"],
|
31
31
|
["[綏靖]1", "@A", "name=[綏靖];-580-01-08"],
|
32
32
|
["[安寧]0", "@A", "name=[安寧];-548-07-03"],
|
33
33
|
["[懿徳]1", "@A", "name=[懿徳];-509-02-04"],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
=begin
|
3
|
-
Copyright (C) 2011-
|
3
|
+
Copyright (C) 2011-2014 Takashi SUGA
|
4
4
|
|
5
5
|
You may use and/or modify this file according to the license described in the LICENSE.txt file included in this archive.
|
6
6
|
=end
|
@@ -20,7 +20,8 @@ module When::Coordinates
|
|
20
20
|
class Kyusei < Residue; end
|
21
21
|
|
22
22
|
# Common Residue
|
23
|
-
CommonResidue = [
|
23
|
+
CommonResidue = [{'V'=>{'0618'=>{'A'=>'awakening_of_insects=,*啓蟄',
|
24
|
+
'B'=>'rain_water=,*雨水'}}}, When::BasicTypes::M17n, [
|
24
25
|
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
25
26
|
"locale:[=en:, ja=ja:, tenreki, tibetan, yi, alias]",
|
26
27
|
"names:[CommonResidue]",
|
@@ -49,7 +50,7 @@ module When::Coordinates
|
|
49
50
|
|
50
51
|
[Residue,
|
51
52
|
"locale:[=en:, ja=ja:, alias]",
|
52
|
-
"label:[StarMansion, *宿]", "divisor:28", "day:17",
|
53
|
+
"label:[StarMansion, *宿]", "divisor:28", "day:17", "format:[%s(%02d)]",
|
53
54
|
[Residue, "label:[Horn=, *角宿, Jiăo= ]", "remainder:0"], # 1 α Vir
|
54
55
|
[Residue, "label:[Neck=, *亢宿, Kàng= ]", "remainder:1"], # 2 κ Vir
|
55
56
|
[Residue, "label:[Root=, *氐宿, Dĭ= ]", "remainder:2"], # 3 α Lib
|
@@ -111,7 +112,7 @@ module When::Coordinates
|
|
111
112
|
],
|
112
113
|
|
113
114
|
[StemBranch,
|
114
|
-
"label:[Stem-Branch, *干支]", "divisor:60", "day:11", "year:4",
|
115
|
+
"label:[Stem-Branch, *干支]", "divisor:60", "day:11", "year:4", "format:[%s(%02d)]",
|
115
116
|
[StemBranch, "label:[kinoe-ne=, *甲子, 甲子, 木男鼠, 木公鼠]", "remainder: 0"],
|
116
117
|
[StemBranch, "label:[kinoto-ushi=, *乙丑, 乙好, 木女牛, 木母牛]", "remainder: 1"],
|
117
118
|
[StemBranch, "label:[hinoe-tora=, *丙寅, 丙寅, 火男虎, 火公虎]", "remainder: 2"],
|
@@ -191,30 +192,30 @@ module When::Coordinates
|
|
191
192
|
[Residue,
|
192
193
|
"locale:[=en:, ja=ja:, alias]",
|
193
194
|
"label:[SolarTerm=en:Solar_term, *二十四節気]", "divisor:360",
|
194
|
-
[Residue, "label:[vernal_equinox=,
|
195
|
-
[Residue, "label:[clear_and_bright=,
|
196
|
-
[Residue, "label:[grain_rain=,
|
197
|
-
[Residue, "label:[start_of_summer=,
|
198
|
-
[Residue, "label:[grain_full=,
|
199
|
-
[Residue, "label:[grain_in_ear=,
|
200
|
-
[Residue, "label:[summer_solstice=,
|
201
|
-
[Residue, "label:[minor_heat=,
|
202
|
-
[Residue, "label:[major_heat=,
|
203
|
-
[Residue, "label:[start_of_autumn=,
|
204
|
-
[Residue, "label:[limit_of_heat=,
|
205
|
-
[Residue, "label:[white_dew=,
|
206
|
-
[Residue, "label:[autumnal_equinox=,
|
207
|
-
[Residue, "label:[cold_dew=,
|
208
|
-
[Residue, "label:[frost_descent=,
|
209
|
-
[Residue, "label:[start_of_winter=,
|
210
|
-
[Residue, "label:[minor_snow=,
|
211
|
-
[Residue, "label:[major_snow=,
|
212
|
-
[Residue, "label:[winter_solstice=,
|
213
|
-
[Residue, "label:[minor_cold=,
|
214
|
-
[Residue, "label:[major_cold=,
|
215
|
-
[Residue, "label:[start_of_spring=,
|
216
|
-
[Residue,
|
217
|
-
[Residue,
|
195
|
+
[Residue, "label:[vernal_equinox=, *春分, 二月中=] ", "remainder:0" ],
|
196
|
+
[Residue, "label:[clear_and_bright=, *清明, 三月節=] ", "remainder:15" ],
|
197
|
+
[Residue, "label:[grain_rain=, *穀雨, 三月中=] ", "remainder:30" ],
|
198
|
+
[Residue, "label:[start_of_summer=, *立夏, 四月節=] ", "remainder:45" ],
|
199
|
+
[Residue, "label:[grain_full=, *小満, 四月中=] ", "remainder:60" ],
|
200
|
+
[Residue, "label:[grain_in_ear=, *芒種, 五月節=] ", "remainder:75" ],
|
201
|
+
[Residue, "label:[summer_solstice=, *夏至, 五月中=] ", "remainder:90" ],
|
202
|
+
[Residue, "label:[minor_heat=, *小暑, 六月節=] ", "remainder:105"],
|
203
|
+
[Residue, "label:[major_heat=, *大暑, 六月中=] ", "remainder:120"],
|
204
|
+
[Residue, "label:[start_of_autumn=, *立秋, 七月節=] ", "remainder:135"],
|
205
|
+
[Residue, "label:[limit_of_heat=, *処暑, 七月中=] ", "remainder:150"],
|
206
|
+
[Residue, "label:[white_dew=, *白露, 八月節=] ", "remainder:165"],
|
207
|
+
[Residue, "label:[autumnal_equinox=, *秋分, 八月中=] ", "remainder:180"],
|
208
|
+
[Residue, "label:[cold_dew=, *寒露, 九月節=] ", "remainder:195"],
|
209
|
+
[Residue, "label:[frost_descent=, *霜降, 九月中=] ", "remainder:210"],
|
210
|
+
[Residue, "label:[start_of_winter=, *立冬, 十月節=] ", "remainder:225"],
|
211
|
+
[Residue, "label:[minor_snow=, *小雪, 十月中=] ", "remainder:240"],
|
212
|
+
[Residue, "label:[major_snow=, *大雪, 十一月節=]", "remainder:255"],
|
213
|
+
[Residue, "label:[winter_solstice=, *冬至, 十一月中=]", "remainder:270"],
|
214
|
+
[Residue, "label:[minor_cold=, *小寒, 十二月節=]", "remainder:285"],
|
215
|
+
[Residue, "label:[major_cold=, *大寒, 十二月中=]", "remainder:300"],
|
216
|
+
[Residue, "label:[start_of_spring=, *立春, 正月節=] ", "remainder:315"],
|
217
|
+
[Residue, 'label:[#{A:rain_water=, *雨水},正月中=] ', "remainder:330"], # 戊寅・儀鳳暦では啓蟄
|
218
|
+
[Residue, 'label:[#{B:awakening_of_insects=,*啓蟄},二月節=] ', "remainder:345"] # 戊寅・儀鳳暦では雨水
|
218
219
|
],
|
219
220
|
|
220
221
|
[Residue,
|
@@ -127,7 +127,7 @@ module When
|
|
127
127
|
module_eval %Q{
|
128
128
|
def #{name}(date, parameter=nil)
|
129
129
|
event_name = 'from_#{name}'
|
130
|
-
date = date.frame.jul_trans(date, {:events=>[event_name]})
|
130
|
+
date = date.frame.jul_trans(date, {:events=>[event_name], :precision=>When::DAY})
|
131
131
|
y,m,d = date.cal_date
|
132
132
|
h,n = (m+5).divmod(7)
|
133
133
|
dow = (182 * h[0] + 30 * n + d - #{k}) % 7
|
@@ -222,7 +222,7 @@ module When
|
|
222
222
|
'border' => '00-01-02',
|
223
223
|
'day_offset' => -183, # the day 183 days before summer solstice
|
224
224
|
'cycle_offset' => Rational(1,4), # summer solstice
|
225
|
-
'
|
225
|
+
'time_basis' => '+09:00', # JST
|
226
226
|
'rule_table' => {
|
227
227
|
365 => {'Length'=>[2]+[30]*6+[3]+[30]*6},
|
228
228
|
366 => {'Length'=>[2]+[30]*6+[4]+[30]*6}
|
@@ -44,6 +44,80 @@ module When
|
|
44
44
|
]]
|
45
45
|
end
|
46
46
|
|
47
|
+
module When::Coordinates
|
48
|
+
|
49
|
+
# 六十干支
|
50
|
+
Tibetan = [When::BasicTypes::M17n, [
|
51
|
+
"namespace:[en=http://en.wikipedia.org/wiki/, ja=http://ja.wikipedia.org/wiki/]",
|
52
|
+
"locale:[=en:, ja=ja:, alias]",
|
53
|
+
"names:[Tibetan]",
|
54
|
+
|
55
|
+
[StemBranch,
|
56
|
+
"label:[Stem-Branch, *干支]", "divisor:60", "day:11", "year:4",
|
57
|
+
[StemBranch, "label:[Wood-Rat=, *木男鼠=]", "remainder: 0"],
|
58
|
+
[StemBranch, "label:[Wood-Ox=, *木女牛=]", "remainder: 1"],
|
59
|
+
[StemBranch, "label:[Fire-Tiger=, *火男虎=]", "remainder: 2"],
|
60
|
+
[StemBranch, "label:[Fire-Rabbit=, *火女兎=]", "remainder: 3"],
|
61
|
+
[StemBranch, "label:[Earth-Dragon=, *土男龍=]", "remainder: 4"],
|
62
|
+
[StemBranch, "label:[Earth-Snake=, *土女蛇=]", "remainder: 5"],
|
63
|
+
[StemBranch, "label:[Iron-Horse=, *金男馬=]", "remainder: 6"],
|
64
|
+
[StemBranch, "label:[Iron-Goat=, *金女羊=]", "remainder: 7"],
|
65
|
+
[StemBranch, "label:[Water-Monkey=, *水男猴=]", "remainder: 8"],
|
66
|
+
[StemBranch, "label:[Water-Rooster=, *水女鷄=]", "remainder: 9"],
|
67
|
+
[StemBranch, "label:[Wood-Dog=, *木男狗=]", "remainder:10"],
|
68
|
+
[StemBranch, "label:[Wood-Pig=, *木女猪=]", "remainder:11"],
|
69
|
+
[StemBranch, "label:[Fire-Rat=, *火男鼠=]", "remainder:12"],
|
70
|
+
[StemBranch, "label:[Fire-Ox=, *火女牛=]", "remainder:13"],
|
71
|
+
[StemBranch, "label:[Earth-Tiger=, *土男虎=]", "remainder:14"],
|
72
|
+
[StemBranch, "label:[Earth-Rabbit=, *土女兎=]", "remainder:15"],
|
73
|
+
[StemBranch, "label:[Iron-Dragon=, *金男龍=]", "remainder:16"],
|
74
|
+
[StemBranch, "label:[Iron-Snake=, *金女蛇=]", "remainder:17"],
|
75
|
+
[StemBranch, "label:[Water-Horse=, *水男馬=]", "remainder:18"],
|
76
|
+
[StemBranch, "label:[Water-Goat=, *水女羊=]", "remainder:19"],
|
77
|
+
[StemBranch, "label:[Wood-Monkey=, *木男猴=]", "remainder:20"],
|
78
|
+
[StemBranch, "label:[Wood-Rooster=, *木女鷄=]", "remainder:21"],
|
79
|
+
[StemBranch, "label:[Fire-Dog=, *火男狗=]", "remainder:22"],
|
80
|
+
[StemBranch, "label:[Fire-Pig=, *火女猪=]", "remainder:23"],
|
81
|
+
[StemBranch, "label:[Earth-Rat=, *土男鼠=]", "remainder:24"],
|
82
|
+
[StemBranch, "label:[Earth-Ox=, *土女牛=]", "remainder:25"],
|
83
|
+
[StemBranch, "label:[Iron-Tiger=, *金男虎=]", "remainder:26"],
|
84
|
+
[StemBranch, "label:[Iron-Rabbit=, *金女兎=]", "remainder:27"],
|
85
|
+
[StemBranch, "label:[Water-Dragon=, *水男龍=]", "remainder:28"],
|
86
|
+
[StemBranch, "label:[Water-Snake=, *水女蛇=]", "remainder:29"],
|
87
|
+
[StemBranch, "label:[Wood-Horse=, *木男馬=]", "remainder:30"],
|
88
|
+
[StemBranch, "label:[Wood-Goat=, *木女羊=]", "remainder:31"],
|
89
|
+
[StemBranch, "label:[Fire-Monkey=, *火男猴=]", "remainder:32"],
|
90
|
+
[StemBranch, "label:[Fire-Rooster=, *火女鷄=]", "remainder:33"],
|
91
|
+
[StemBranch, "label:[Earth-Dog=, *土男狗=]", "remainder:34"],
|
92
|
+
[StemBranch, "label:[Earth-Pig=, *土女猪=]", "remainder:35"],
|
93
|
+
[StemBranch, "label:[Iron-Rat=, *金男鼠=]", "remainder:36"],
|
94
|
+
[StemBranch, "label:[Iron-Ox=, *金女牛=]", "remainder:37"],
|
95
|
+
[StemBranch, "label:[Water-Tiger=, *水男虎=]", "remainder:38"],
|
96
|
+
[StemBranch, "label:[Water-Rabbit=, *水女兎=]", "remainder:39"],
|
97
|
+
[StemBranch, "label:[Wood-Dragon=, *木男龍=]", "remainder:40"],
|
98
|
+
[StemBranch, "label:[Wood-Snake=, *木女蛇=]", "remainder:41"],
|
99
|
+
[StemBranch, "label:[Fire-Horse=, *火男馬=]", "remainder:42"],
|
100
|
+
[StemBranch, "label:[Fire-Goat=, *火女羊=]", "remainder:43"],
|
101
|
+
[StemBranch, "label:[Earth-Monkey=, *土男猴=]", "remainder:44"],
|
102
|
+
[StemBranch, "label:[Earth-Rooster=, *土女鷄=]", "remainder:45"],
|
103
|
+
[StemBranch, "label:[Iron-Dog=, *金男狗=]", "remainder:46"],
|
104
|
+
[StemBranch, "label:[Iron-Pig=, *金女猪=]", "remainder:47"],
|
105
|
+
[StemBranch, "label:[Water-Rat=, *水男鼠=]", "remainder:48"],
|
106
|
+
[StemBranch, "label:[Water-Ox=, *水女牛=]", "remainder:49"],
|
107
|
+
[StemBranch, "label:[Wood-Tiger=, *木男虎=]", "remainder:50"],
|
108
|
+
[StemBranch, "label:[Wood-Rabbit=, *木女兎=]", "remainder:51"],
|
109
|
+
[StemBranch, "label:[Fire-Dragon=, *火男龍=]", "remainder:52"],
|
110
|
+
[StemBranch, "label:[Fire-Snake=, *火女蛇=]", "remainder:53"],
|
111
|
+
[StemBranch, "label:[Earth-Horse=, *土男馬=]", "remainder:54"],
|
112
|
+
[StemBranch, "label:[Earth-Goat=, *土女羊=]", "remainder:55"],
|
113
|
+
[StemBranch, "label:[Iron-Monkey=, *金男猴=]", "remainder:56"],
|
114
|
+
[StemBranch, "label:[Iron-Rooster=, *金女鷄=]", "remainder:57"],
|
115
|
+
[StemBranch, "label:[Water-Dog=, *水男狗=]", "remainder:58"],
|
116
|
+
[StemBranch, "label:[Water-Pig=, *水女猪=]", "remainder:59"]
|
117
|
+
]
|
118
|
+
]]
|
119
|
+
end
|
120
|
+
|
47
121
|
module CalendarTypes
|
48
122
|
|
49
123
|
#
|
@@ -83,11 +157,18 @@ module When
|
|
83
157
|
def _normalize(args=[], options={})
|
84
158
|
intercalary_month = When.Resource('_m:TibetanTerms::IntercalaryMonth::*')
|
85
159
|
intercalary_day = When.Resource('_m:TibetanTerms::IntercalaryDay::*')
|
86
|
-
@indices ||=
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
160
|
+
@indices ||= @index_of_MSC && @index_of_MSC.to_i == 1 ?
|
161
|
+
[
|
162
|
+
Coordinates::Index.new({:unit=>60}),
|
163
|
+
Coordinates::Index.new({:branch=>{0=>intercalary_month[0], 1=>intercalary_month[1]},
|
164
|
+
:trunk=>When.Resource('_m:TibetanTerms::Month::*'), :shift=>2}),
|
165
|
+
Coordinates::Index.new({:branch=>{-2=>intercalary_day[0], -1=>intercalary_day[1]}})
|
166
|
+
] :
|
167
|
+
[
|
168
|
+
Coordinates::Index.new({:branch=>{0=>intercalary_month[0], 1=>intercalary_month[1]},
|
169
|
+
:trunk=>When.Resource('_m:TibetanTerms::Month::*'), :shift=>2}),
|
170
|
+
Coordinates::Index.new({:branch=>{-2=>intercalary_day[0], -1=>intercalary_day[1]}})
|
171
|
+
]
|
91
172
|
@label ||= When.Resource('_m:TibetanTerms::Tibetan')
|
92
173
|
@epoch_in_CE ||= 0
|
93
174
|
@type ||= 1
|
@@ -113,6 +194,7 @@ module When
|
|
113
194
|
'A0'=>(22.0+28.0/126)
|
114
195
|
}
|
115
196
|
end
|
197
|
+
@note = 'TibetanNotes'
|
116
198
|
super
|
117
199
|
end
|
118
200
|
|
@@ -111,7 +111,7 @@ module When
|
|
111
111
|
module_eval %Q{
|
112
112
|
def #{name}(date, parameter=nil)
|
113
113
|
event_name = 'from_#{name}'
|
114
|
-
date = When.Calendar('World').jul_trans(date, {:events=>[event_name]})
|
114
|
+
date = When.Calendar('World').jul_trans(date, {:events=>[event_name], :precision=>When::DAY})
|
115
115
|
y,m,d = date.cal_date
|
116
116
|
dow = (m % 6 == 0 && d == 31) ? 7-#{k} : ([4,6,2][m % 3] + d - #{k}) % 7
|
117
117
|
return date if dow == 0
|
@@ -54,9 +54,9 @@ module When::TimeStandard
|
|
54
54
|
[2454832.5, 34.0],
|
55
55
|
[2456109.5, 35.0]]
|
56
56
|
|
57
|
-
DeltaT = [
|
58
|
-
63.
|
59
|
-
66.
|
57
|
+
DeltaT = [ 63.467, # 1999
|
58
|
+
63.827, 64.092, 64.300, 64.473, 64.573, 64.689, 64.846, 65.145, 65.456, 65.779, # 2000-
|
59
|
+
66.070, 66.324, 66.603, 66.909 # 2010-
|
60
60
|
]
|
61
61
|
|
62
62
|
class << self
|
@@ -304,6 +304,83 @@ module When::TimeStandard
|
|
304
304
|
# @private
|
305
305
|
DeltaThreshold = DeltaT[-2] - delta_t_observed_poly(YearThreshold)
|
306
306
|
|
307
|
+
#
|
308
|
+
# When::TM::Calendar のための TimeBasis の初期化
|
309
|
+
#
|
310
|
+
# @private
|
311
|
+
module TimeBasis
|
312
|
+
|
313
|
+
module FixedTimeBasis
|
314
|
+
|
315
|
+
private
|
316
|
+
|
317
|
+
# 太陽黄経のための日付境界のオフセットを反映した通日
|
318
|
+
#
|
319
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
320
|
+
#
|
321
|
+
# @return [Integer]
|
322
|
+
#
|
323
|
+
def solar_sdn(t)
|
324
|
+
(t + 0.5 + @_time_basis_offset[0]).floor
|
325
|
+
end
|
326
|
+
|
327
|
+
# 月の位相のための日付境界のオフセットを反映した通日
|
328
|
+
#
|
329
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
330
|
+
#
|
331
|
+
# @return [Integer]
|
332
|
+
#
|
333
|
+
def lunar_sdn(t)
|
334
|
+
(t + 0.5 + @_time_basis_offset[-1]).floor
|
335
|
+
end
|
336
|
+
end
|
337
|
+
|
338
|
+
module ApparentTimeBasis
|
339
|
+
|
340
|
+
private
|
341
|
+
|
342
|
+
# 太陽黄経のための日付境界のオフセットを反映した通日
|
343
|
+
#
|
344
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
345
|
+
#
|
346
|
+
# @return [Integer]
|
347
|
+
#
|
348
|
+
def solar_sdn(t)
|
349
|
+
time_basis.time_standard.from_dynamical_date(t + 0.5 + @_time_basis_offset[0]).floor
|
350
|
+
end
|
351
|
+
|
352
|
+
# 月の位相のための日付境界のオフセットを反映した通日
|
353
|
+
#
|
354
|
+
# @param [Numeric] t ユリウス日(Terrestrial Time)
|
355
|
+
#
|
356
|
+
# @return [Integer]
|
357
|
+
#
|
358
|
+
def lunar_sdn(t)
|
359
|
+
time_basis.time_standard.from_dynamical_date(t + 0.5 + @_time_basis_offset[-1]).floor
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
#
|
364
|
+
# When::TM::Calendar のための TimeBasis の初期化
|
365
|
+
#
|
366
|
+
def _normalize_time_basis
|
367
|
+
|
368
|
+
@_time_basis ||= @time_basis || (@location ? @location.long / When::Coordinates::Spatial::DEGREE * 240 : When.utc)
|
369
|
+
@_time_basis = When::Parts::Locale._split(@_time_basis) if @_time_basis.kind_of?(String)
|
370
|
+
@_time_basis = [@_time_basis] unless @_time_basis.kind_of?(Array)
|
371
|
+
@_time_basis = @_time_basis.map {|clock| When.Clock(clock)}
|
372
|
+
@_time_basis_offset = @_time_basis.map {|clock| -clock.universal_time / When::TM::Duration::DAY}
|
373
|
+
|
374
|
+
@time_basis = @_time_basis[0] if @time_basis
|
375
|
+
|
376
|
+
if @_time_basis[0].time_standard.kind_of?(LocalApparentTime)
|
377
|
+
class << self; include ApparentTimeBasis ; end
|
378
|
+
else
|
379
|
+
class << self; include FixedTimeBasis ; end
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
307
384
|
#
|
308
385
|
# 時刻系のひながた
|
309
386
|
#
|
@@ -497,7 +574,8 @@ module When::TimeStandard
|
|
497
574
|
# @return [Numeric] local apparent time
|
498
575
|
#
|
499
576
|
def from_dynamical_time(time)
|
500
|
-
super(time) + When::TM::Duration::DAY * @
|
577
|
+
super(time) + When::TM::Duration::DAY * (@location.long / (360.0 * When::Coordinates::Spatial::DEGREE) +
|
578
|
+
@datum.equation_of_time(When::TM::JulianDate._t_to_d(time)))
|
501
579
|
end
|
502
580
|
|
503
581
|
private
|
@@ -505,7 +583,7 @@ module When::TimeStandard
|
|
505
583
|
# オブジェクトの正規化
|
506
584
|
def _normalize(args=[], options={})
|
507
585
|
@location ||= '_l:long=0&lat=0'
|
508
|
-
@location = When.Resource(@location
|
586
|
+
@location = When.Resource(@location) if @location.kind_of?(String)
|
509
587
|
@datum = When.Resource(@datum || '_ep:Earth' )
|
510
588
|
super
|
511
589
|
end
|
@@ -556,11 +634,11 @@ module When::TimeStandard
|
|
556
634
|
d, t = [-1, +1].map {|v| @formula.day_event(date, v, When.Resource('_ep:Sun'), @height)}
|
557
635
|
|
558
636
|
if date < d # after midnight
|
559
|
-
t = @formula.
|
637
|
+
t = @formula.sunset(date-1, @height)
|
560
638
|
f = (date - t) / (d - t) / 2 - 0.25
|
561
639
|
|
562
640
|
elsif date > t # before midnight
|
563
|
-
d = @formula.
|
641
|
+
d = @formula.sunrise(date+1, @height)
|
564
642
|
f = (date - t) / (d - t) / 2 - 0.25
|
565
643
|
|
566
644
|
else # day time
|