Indian Luni-Solar Calendar
日時要素の翻訳表の取得
引数パターン1 date : [y] y - 年 returns : [When::Coordinates::Pair] 1年の月の配置の翻訳表 引数パターン2 date : [y, m] y - 年 m - 月(0 始まりの通番) returns : [When::Coordinates::Pair] 1月の日の配置の翻訳表
# File when/region/indian.rb, line 241 241: def _ids_(date) 242: y, m = date 243: y = +y 244: mm = _new_year_month(y) 245: return (_table(_new_month_(mm+m.to_i)) {|i| _new_month(mm+m+i/15.0)}) if m 246: table = (0...26).to_a.map {|i| _tithi_to_coordinates((mm+i)*15)[1]} 247: table.pop while table[1].trunk < 11 248: return table 249: end
月初の通日
m : 通月 returns : 月初の通日
# File when/region/indian.rb, line 184 184: def _new_month_(m) 185: new_moon_time = @formula[1].cn_to_time(m) 186: new_moon_date = (new_moon_time + 0.5 + @formula[1].long/360.0).floor 187: sun_rise_time = @formula[1].sun_rise(new_moon_date) 188: (sun_rise_time >= new_moon_time) ? new_moon_date : new_moon_date+1 189: end
年初の通月
y : 年 returns : 年初の通月
# File when/region/indian.rb, line 197 197: def _new_year_month_(y) 198: (Residue.mod(y-1) {|t| _tithi_to_coordinates(t*15)[0]})[0] + 1 199: end
朔望日 -> 年・月・日
tithi : 朔望日(月の位相 / (CIRCLE/30)) returns : [y, m, d] y - 年(Integer) m - 月(When::Coordinates::Pair) d - 日(Integer)
# File when/region/indian.rb, line 210 210: def _tithi_to_coordinates(tithi) 211: m, d = tithi.divmod(30) 212: s = [0,1,2].map {|i| (@formula[0].time_to_cn(30*(m+i)) - @cycle_offset).floor + 1 } 213: f = s[0]==s[1] 214: if (d >= 15.0) 215: d -= 15 216: b = true 217: n = true unless @indian_style==0 218: f = s[1]==s[2] if @indian_style==1 219: end 220: y, m = (n ? s[1] : s[0]).divmod(12) 221: return [y-@year_epoch, Pair._force_pair(m+1, LEAP_MAP[[b,f]][@indian_style]), d.floor] 222: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.